Forum Moderators: phranque
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]
I have the above rules in my .htaccess file, but I have the following problems.
[mydomain.com...] produces a 404 error, would like to produce [mydomain.com...]
AND
[mydomain.com...] produces a 300 error, would like to produce [mydomain.com...]
Any help would be much appreciated
Thanks,
Dizzynutter
Welcome to WebmasterWorld.
There are a couple of ways to do this:
Using the implicit 'and anything else' is the fastest, but has the lease control:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index [NC]
RewriteRule ^index http://mydomain.com/ [NC,R=301,L]
Using the 0 or 1 (?) flag will also work:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index(\.html)?/?\ HTTP/ [NC]
RewriteRule ^index(\.html)?/?$ http://mydomain.com/ [NC,R=301,L]
Adding the 'No Cose' (NC) flag will make INDEX a match.
Use the one you think works best for you.
Hope this helps.
Justin