Place this rule in root .htaccess of domain.com
:
RewriteEngine on
ewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^ http://foo.com%{REQUEST_URI} [L,R=301]
Pregunta
I have two domains:
http://www.domain.com and http://domain.com each pointing to the same directory. Now I got a new domain (http://foo.com)
Unfortunately a catch all directive would not work, because names changed for subdirectories. I need about 20 single redirects, e.g.
/file1.html -> /newdir/
/x.html -> /y/
...
That means, both http://www.domain.com/dir1 and http://domain.com/dir1 should be redirected permanently to http://foo.com/newdir1. And the same with the other directories. How can I achive that via htaccess redirects?
No hay solución correcta
Otros consejos
Place this rule in root .htaccess of domain.com
:
RewriteEngine on
ewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^ http://foo.com%{REQUEST_URI} [L,R=301]
Try this
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^folder1(.*)$ http://www.newdomain.com/$1 [L,R=301]