Forum Moderators: phranque
I've got a unique situation here that I can't find a solution. I want to redirect a-b-c.com to abc.com
I have already successfully do a 301 redirect for all my subpages in a-b-c.com, such as a-b-c.com/123.htm to abc.com/123.htm etc, and now its left with the index page.
I tried using the code:
Options +Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/ [NC]
RewriteRule ^(([^/]+/)*)index\.htm$ [abc.com...] [R=301,L]
But this only allow me to redirect a-b-c.com/index.htm and not a-b-c.com
However I don't want to do a 301 redirect on the root directory because this will overwrite all the redirects of my subpages, which cause them all to be redirected to www.abc.com instead.
Is there a way I can redirect just both a-b-c.com and a-b-c.com/index.htm to abc.com without affecting the rest of the 100+ subpages?
However, it's obvious that you are not checking the %{HTTP_HOST} variable, and that only example.com/index.html and not example.com/ is redirected, so this rule won't accomplish all of your goals even as-is.
Another issue may be rule order; Put your redirects in order with external redirects first, in order from most-specific (fewest URLs affected) to least specific (most URLs affected), followed by your internal rewrites (if any), again ordered from most- least-specific.
Jim