Forum Moderators: phranque

Message Too Old, No Replies

301 issue with addon domains

301 addon

         

esprague

10:55 pm on Feb 17, 2011 (gmt 0)

10+ Year Member



We had to 301 the home page of our main site. We did not want to 301 the home pages of its addon domains but it seems this change in the main .htaccess has propagated such that the addon home pages now 301 as well.

Here is the .htaccess line:
#redirect 301 /index.php [xyz.com...]

Again, the .htaccess files of the addon domains have not changed but now they redirect. How do we write this differently so that the addon homepages do not 301?

jdMorgan

4:49 am on Feb 18, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use mod_rewrite instead of mod_alias so that you can check the requested hostname:

RewriteCond %{HTTP_HOST} ^(www\.)?xyz\.com
RewriteRule ^index\.php$ http://www.xyz.com/newpageexample.php [R=301,L]

Do not mix mod_alias and mod_rewrite directives. If you use mod_rewrite for any redirects or rewrites, then use it for all redirects and rewrites.

Also, the order of your rules is critical. I suggest the following to prevent major problems with site function and with search engine rankings:

Access control rules first, external redirects next, internal rewrites last. In each group, the rules should be in order from most-specific URL-path-patterns and conditions to least-specific. And this applies across all configuration files in the entire hierarchy: Server config files, cPanel, and all .htaccess files. Be very sure that no internal rewrite can be executed before any external redirect. If you allow this, then you will expose internal filepaths as URLs to browsers and search engines, and this can seriously damage your search rankings (This one simple error can put an e-commerce site out of business if it has serious competition).

Jim