Forum Moderators: open

Message Too Old, No Replies

Mirror site redirection

301 Permanent Redirection?

         

MWpro

3:41 am on Feb 25, 2003 (gmt 0)

10+ Year Member



I have come across a mirror of my site, I don't know how it got there but I did a ping on both my site and the mirror site and the ip's are identical. Lets say the mirror is strangeword.at (this is really the extension on the mirror site) and my site is mysite.com.

I want a script that would redirect the visitors if they enter from strangeword.at to mysite.com. I read some old threads relating to this and someone suggested a 301 permanent redirection.

My question is would the 301 permanent redirection script solve this problem? If so how would I set it up? I am new to using .htaccess and any help that can be given to me on this subject would be appreciated.

jdMorgan

4:36 am on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MWpro,

The following code, added to your web root .htaccess file, will solve your problem. Replace quux-corp.org with your correct domain name. The dots should be escaped with preceding slashes exactly as shown, and only where shown.


# Redirect non-standard incoming domains to standard www.quux-corp.org
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.quux-corp\.org
RewriteRule ^(.*)$ http://www.quux-corp.org/$1 [L,R=permanent]

See this Introduction to mod_rewrite [webmasterworld.com] post for a lot of useful information and links to reference material.

HTH,
Jim

[edited by: jdMorgan at 5:28 am (utc) on Feb. 25, 2003]

MWpro

5:22 am on Feb 25, 2003 (gmt 0)

10+ Year Member



Thank you for the quick reply

When using that code I get a 500 Internal Server Error. Did I enter something wrong?

# Redirect non-standard incoming domains to standard www.mysite.com
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.mysite\.com
RewriteRule ^(.*)$ [mysite...] [L,R=permanent]

jdMorgan

5:32 am on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MWpro,

No, the WebmasterWorld forum software clobbered the required space before the "!" in my reply - see correction in my post above.

If you still get a 500 error after correcting that, then you may need to contact your host to see if you have mod_rewrite available to you.

Jim

MWpro

10:34 pm on Feb 25, 2003 (gmt 0)

10+ Year Member



Works like a charm, thank you for your help.