The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess/parked domains 301 failing

Discussion in 'General Discussion' started by n3tph4t, Jun 28, 2007.

  1. n3tph4t

    n3tph4t Active Member

    Joined:
    Jan 31, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Hi, I have a problem which has confused me and 3 admins, any help you can give yould be greatly appreciated (and earn kudos from us mere mortals :) ):


    maindomain.com = the main domain
    parked1.com = parked domain
    parked2.co.uk = parked domain

    all three have directives in an .htaccess file in the root of maindomain.com's web folder : /home/main/www/.htaccess as follows:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^maindomain\.com
    RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=permanent,L]
    RewriteCond %{HTTP_HOST} ^parked1\.com
    RewriteRule ^(.*)$ http://www.parked1.com/$1 [R=permanent,L]
    RewriteCond %{HTTP_HOST} ^parked2\.co.uk
    RewriteRule ^(.*)$ http://www.parked2.co.uk/$1 [R=permanent,L]

    Yesterday produced the following results when entering the domains:

    http://maindomain.com successfully redirected to http://www.maindomain.com
    http://parked1.com incorrectly redirected to http://www.maindomain.com
    http://parked2.co.uk successfully redirected to http://www.parked2.co.uk

    Today (after changing nothing):
    http://maindomain.com successfully redirected to http://www.maindomain.com
    http://parked1.com successfully redirected to http://www.parked1.com
    http://parked2.co.uk incorrectly redirected to http://www.maindomain.com

    So far I have checked the following:
    1. No .htaccess files exist above the www folder which would override the one which exists.
    2. /var/named/maindomain.com.db, parked1.com.db and parked2.co.uk look correct.
    3. /etc/named.conf correctly lists each domains .db file
    4. /usr/local/apache/conf/httpd.conf looks correct as follows:
    Code:
    <VirtualHost 11.222.333.444>
    ServerAlias maindomain.com
    ServerAdmin webmaster@maindomain.com
    DocumentRoot /home/main/public_html
    BytesLog domlogs/maindomain.com-bytes_log
    User main
    Group main
    ServerName www.maindomain.com
    ServerAlias parked1.com www.parked1.com
    ServerAlias parked2 www.parked2.co.uk
    
    
    <IfModule mod_userdir.c>
      Userdir disabled
      Userdir enabled main 
    </IfModule>
    
    <IfModule mod_php4.c>
      php_admin_value open_basedir "/home/main:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule mod_php5.c>
      php_admin_value open_basedir "/home/main:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    
    User main
    Group main
    CustomLog /usr/local/apache/domlogs/maindomain.com combined
    ScriptAlias /cgi-bin/ /home/main/public_html/cgi-bin/
    </VirtualHost>
    I have tested that the local .htaccess is being processed with some other domains and they perform as expected, the DNS looks fine as does apache and as far as I can tell the conf files are fine.

    This has been bugging me for nearly 5 days now and I am really struggling. Any help you can give would be very much appreciated.
     
  2. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    What I don't understand is why you are using directives in an .htaccess file?

    If you setup Parked Domains through cPanel then no .htaccess directives are required -- if the Parked Domains are using the same Nameservers as the Main Domain.
     
  3. n3tph4t

    n3tph4t Active Member

    Joined:
    Jan 31, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Hi Rob,
    I have fixed the issue now. I had an old DNS entry in an off-site DNS server which was pointing to an IP which had a forwarder to the www.maindomain.com domain.

    I am using the .htaccess for SEO purposes to ensure any http://domain.com links are converted to http://www.domain.com links

    Thanks
     
  4. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Glad to hear the problem got sorted out.

    As part of my confusion regarding the .htaccess directives, I wonder if you are aware that with or without the 'www' really makes no difference for SEO? The 'www' is long past its lifetime and is gradully being phased out.

    When you think about it, Registering a Domain name does not require using 'www' as technically, 'www' is part of a Subdomain. An up-to-date Server has no problem serving Web pages without the 'www' and Browsers / Search Engines have no problem finding them.

    This is similar to the confusion some people have about whether to singular or plural Keywords -- it makes no difference, both will be found.

    Just a thought. :)
     
  5. n3tph4t

    n3tph4t Active Member

    Joined:
    Jan 31, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Hey Rob,
    Thanks for the reply. My reasoning behind the www. was not that I wish to make sure they get listed but to make sure that google (et al) knew that these two domains (as essentially they would be considered to be 2 domains www. and non-www.) are actually the same domain with the same content. By doing so, the likleyhood of being penalised for domain spamming is greatly reduced. Also, it means that my pagerank etc is focused on one domain and not spread between two thereby increasing my pagerank and making sure that any visitors who ctrl+c from the addressbar always get the domain I want them to be linking to rather then the non-www. version.

    You may be right, maybe it makes no difference, I have seen examples on other sites I run where the pageranks have been different for www. but then there may be other reasons for that. At least this way I feel I have done all I can to try and cover myself.

    Thanks again and have a good one :)
     
Loading...

Share This Page