Forum Moderators: phranque

Message Too Old, No Replies

.htaccess redirects stopped working!

any ideas why this should not work?

         

inbound

8:34 pm on May 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I got some great help here before but for some reason my server has stopped redirecting traffic. It could be due to installing AWStats, but I'm not sure. As the server is 'managed' I am restricted slightly although I think I can get shell access if required (and I get really good instructions).

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]

jd01

11:47 pm on May 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi inbound,

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.