Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 02, 2015, 11:29:19 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Any CPanel Gurus out there?  (Read 1953 times)

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,969
    • View Profile
    • Dales Computer Services
    • Donate to Member
Any CPanel Gurus out there?
« on: August 21, 2010, 06:48:12 AM »
I have a CPanel account with one main domain registered (say main.com) and two parked domains (parked1.com and parked2.com).

I want to set it up so that if anyone puts any of those three domain names into a browser then the parked1.com domain is visited and the URL changed to reflect the correct URL.

Currently if I put any of the domain names into a browser the website displays properly but with the URL I entered not based on parked1.com?

Any ideas how to achieve this?

I have tried domain redirects (both in the Parked domain section, and the Redirects section) but they seem to have no effect. It may be because I have a .htaccess file which may override redirects (but I don't know a lot about .htaccess to change a complex file).

AndeT1

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Any CPanel Gurus out there?
« Reply #1 on: August 21, 2010, 11:56:30 AM »
I think you actually have to get into the HTML on your main page.<br>In the header area of your default page (index.htm or index.html), but a little JavaScript that looks at the actual page requested and then re-routes the browser to that page.<br>In this way, the user is sent to the page requested, no matter what the main page is named.
or
Change your parked domains to addon domains and you'll get exactly what you want. :-)
« Last Edit: August 21, 2010, 12:03:15 PM by AndeT1 »

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,969
    • View Profile
    • Dales Computer Services
    • Donate to Member
Re: Any CPanel Gurus out there?
« Reply #2 on: August 21, 2010, 12:15:15 PM »
So something like this:

Code: [Select]
<html>
<head>
  <script type="text/javascript">
       <!--
          if document.domain != "www.parked1.com"
              {
                document.location = "http://www.parked1.com"
              }
       //-->
  </script>
</head>

<body>



</body>
</html>

This would work if I was using HTML but it is a Joomla based website and this would mean placing this in the template and having it test every time a page is requested.

Is there anyway I can set this up in the .htaccess or in CPanel so that it happens automatically?
« Last Edit: August 21, 2010, 02:50:36 PM by Carol Haynes »

AndeT1

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Any CPanel Gurus out there?
« Reply #3 on: August 21, 2010, 12:59:25 PM »
As above:

"or
Change your parked domains to addon domains and you'll get exactly what you want. :-)"

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Any CPanel Gurus out there?
« Reply #4 on: August 21, 2010, 01:41:30 PM »
I just have the single domain, so I'm not familiar with these other features.  But I know there are a ton of .htaccess guides on the web.  Many very detailed.  Also you might look for a forum by your hosting service.  Many times other users will know the exact .htaccess command/feature to point you in the right direction.

Sounds like AndeT1's solution is the simplest. But I can't verify it from my limited experience. :(

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,969
    • View Profile
    • Dales Computer Services
    • Donate to Member
Re: Any CPanel Gurus out there?
« Reply #5 on: August 21, 2010, 02:48:42 PM »
Thanks for the feedback.

I just found a .htaccess solution that works:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.parked1.com$
RewriteRule ^(.*)$ http://www.parked1.com/$1 [R=301]

Had a bit of a puzzle where to put this in .htaccess but found it worked fine if I put it before SEF rewrites.