Forum Moderators: phranque
I studied all WebmasterWorld threads and could have sworn that the below should work -- but it does not -- HELP
on domain1.com: the .htaccess file
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.domain1\.com [NC]
RewriteRule (.*) [domain1.com...] [R=301,L]
Redirect permanent / [domain2.com...]
The same files exist on domain1.com and domain2.com like
www.domain1.com/folder/Tool/1/1, and
www.domain2.com/folder/Tool/1/1
BUT, if you try to visit www.domain1.com/folder/Tools/1/1
you dont get redirected to [domain2.com...] -- you get a page not found.
What am I missing here?
I am not sure why you are wanting to redirect twice, when there is really only a need to redirect one time - straight to www.domain2.com - Maybe I am missing something?
If you truly would like to redirect twice you could use the following:
If none of your rewrites are working you may need:
AllowOverride FileInfo
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain1\.com [NC]
RewriteRule (.*) http://www.domain1.com/$1 [R=301,L]
RewriteRule (.*) http://www.domain2.com/$1 [R=301,L]
If you would only like a single redirect from either domain1.com or www.domain1.com, you can use the single rule:
RewriteRule (.*) http://www.domain2.com/$1 [R=301,L]
and all requests will be directed to www.domain2.com.
Hope this helps.
Justin
#1) is just to resolve the domain.com vs www.domain.com issue.
#2) is to do the redirect from domain1 to domain2
I did find one small error but still have the same issue.
Redirect permanent / [domain2.com...]
SHOULD BE
Redirect permanent / [domain2.com...]
The problem here is unclear, because the code should work. How and where are all these domains hosted? Same host? Same account? Are some of them hosted in subdirectories of a 'main' domain? What's the hosting relationship between them? That info may be needed to solve this problem.
Jim
.htaccess #1 (on domain1)
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) [domain2.com...] [R=301,L]
and
.htaccess #2 (on domain1)
Redirect permanent / [domain2.com...]
- Are they the same?
- If so which would be the "recommended" method?
- Would the information at a tool like rexswains http viewer show both of these to have the same http responses and response codes?