Forum Moderators: phranque

Message Too Old, No Replies

yet another redirect issue!

hope JD is around

         

jbgilbert

3:38 am on Jul 12, 2005 (gmt 0)

10+ Year Member



My objective is 2 fold:
1) redirect domain1.com to www.domain1.com, and
2) redirect all requests for pages on domain1.com
to the same named page on domain2.com

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?

jd01

4:40 am on Jul 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Probably not the jd you were hoping for, but I will see if I can take a stab...

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

jbgilbert

4:43 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



Justin...
I believe you misread my #1 and #2 objectives.

#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...]

jdMorgan

5:38 pm on Jul 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think Justin's point was, why bother to redirect domain1 to www.domain1 if you're then going to redirect them both to www.domain2?

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

jbgilbert

3:06 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Thanks... I'm changing to what you have suggested. But, assuming all is to be "permanently redirected" to domain 2, are the following two methods equivalent:

.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?

jdMorgan

5:31 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, they are equivalent. Use whichever you prefer for any reason.

Any HTTP header checker will show an identical 301-redirect response.

Jim