Forum Moderators: phranque
My .htaccess file serves the following purposes:
1. Sets server side includes for .htm files
2. Redirects all domains pointed a given directory to the a domain I like the visitors to appear at. The other domains are usually hyphenated versions of the main one.
3. Sends all domain traffic to the www. version. This keeps the full url so going to [example.com...] redirects to [example.com...]
4. It does this for around a dozen sites with around 40 domains, worked perfectly before, don't know when it broke.
Here is the code (there are more declarations but along the same format). I hope someone can help. Thanks
Options +IncludesNOEXEC
AddType text/html .htm
AddHandler server-parsed .htm
redirect 301 /many_domains_point_to_this_directory/ [redirect_to_this_domain.co.uk...]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^redirect_to_this_domain\.co.uk [NC]
RewriteRule ^redirect_to_this_domain/(.*) [redirect_to_this_domain.co.uk...] [R=301,L]
I am not sure I see exactly what is wrong, but I can tell you I use the opposite statement to accomplish the same goal... You might look in to trying this:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.mysite\.com) [NC]
RewriteRule (.+) http://www.mysite.com/$1 [R=301,L]
If this is always your first 'ruleset' anything that is not the 'www' version will be redirected before anything else happens, then this 'ruleset' will fail and your other redirects/rewrites should be effective.
Hope this helps.
Justin
Added: This should also help if anyone tries to 'frame' your site.