Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

Rewrite Rule

mapping to a different URL

2:08 pm on Feb 4, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Dec 18, 2002
votes: 0


I would like to alter our .htaccess so that when someone goes to any page on our website they are redirected to an identical directory but on another domain.

For example,
if someone goes to www.abc.com/pages/etc/fred.php
they are redirected to www.xyz.com/pages/etc/fred.php

There are multiple directories and sub directories.
It should also work whether or not visitors use "www".

From the forums I gleaned the following, however it does not seem to work...

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.xyz\.com
RewriteCond %{HTTP_HOST}!^111\.222\.333\.444
RewriteRule ^(.*)$ http://www.xyz.com/$1 [R=permanent,L]

I know rewrite works on our servers

Thank you in advance :-)

2:45 pm on Feb 4, 2003 (gmt 0)

Administrator from US 

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 21, 1999
votes: 11

You could do a simple redirect:

Redirect 301 /fred [webmasterworld.com...]

Will redirect all traffice from the fred directory to www.webmasterworld.com/fred/