Forum Moderators: phranque

Message Too Old, No Replies

Redirect in htaccess

Works with filename but not with /

         

Paul in South Africa

4:11 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



I have a number of domains all with the same IP address and to avoid duplicate content penalties I am trying to use 301 redirects. Most of it is now working perfectly however the following code does not do what I think it should do.

RewriteCond %{HTTP_HOST} ^(www\.)?example\.biz$ 
RewriteRule ^(.*) http://www.example.co.za/$1 [R=301,L]

From what I have learned here, that should redirect www.example.biz/page.html to www.example.co.za/page.html and it does that perfectly. The problem comes when I type in www.example.biz/ without a page name. Then no redirect occurs.

Bearing in mind that this is my first ever attempt at something like this, can anyone spot what I can done wrong.

jdMorgan

1:56 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paul,

There's nothing obviously wrong with your code - the problem is likely to be elsewhere.

Sometimes, other server settings can interfere with even simple rewrites. There are many threads here discussing some of these side-effects, such as those you can find with this search [google.com].

Jim