Page 1 of 1

Redirects with htaccess

Posted: Sun Nov 12, 2006 10:22 am
by Cyril
Hi,

A few months ago I set up 301 redirects on a domain name through the htaccess file. Now it seems that the server does not handle them anymore. I have used RedirectPermanent, Redirect 301 directives and rewrite rules, but with no success. Did you make any changes recently on the AllowOverride directive from the Apache Core ?

My htaccess looks fine to me :

Code: Select all

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,L]
Thanks for your assistance
Cyril

Re: Redirects with htaccess

Posted: Sun Nov 12, 2006 1:15 pm
by Cyril
I found the solution. To whom may be interested :

To 'search engine friendly' redirect a domain name to another, use in your htaccess :

Code: Select all

Options +FollowSymlinks 
RewriteEngine on 

Redirect permanent http://www.olddomain.com http://www.domain.com 
Redirect permanent http://olddomain.com http://www.domain.com 

RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,L]