Link to home
Start Free TrialLog in
Avatar of LetsLearn
LetsLearn

asked on

Apache rewrite

Hi,

I'm having problems with an Apache rewrite rule. I have the below rewrite (snippet shown) however I need to add to have all traffic coming from a certain site, eg www.domain-x.com, sent to www.domain-y.com. My IT person is off on leave and I do not want to ruin his work!

Many thanks in advance.



RewriteEngine On

#RewriteCond %{HTTPS} !on
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}




# For UI Start
RewriteBase /

### For Index page
RewriteRule ^([a-zA-z0-9-_=+]+)/$ index.php?memberdata=$1 [NC,L]

RewriteRule ^([a-zA-z0-9-_=+]+)$ index.php?memberdata=$1 [NC,L]

RewriteRule ^([a-zA-z0-9-_=+]+)/home$ index.php?memberdata=$1 [NC,L]

RewriteRule ^([a-zA-z0-9-_=+]+)/home/$ index.php?memberdata=$1 [NC,L]
Avatar of xterm
xterm

In the VirtualHost directive for www.domain-x.com put:

RewriteEngine On
RewriteRule ^/(.*)         http://www.domain-y.com/$1 [L,R]

This will work if they just put the base site, or if they put /foo/bar.htm on the end, it will take them to the alternate site with the same path extension.
Avatar of LetsLearn

ASKER

sorry just one more question what if it is a only sub-directory to a sub-directory? eg www.domain-x.com/folder/home to www.domain-y.com/new_folder_name/home
ASKER CERTIFIED SOLUTION
Avatar of xterm
xterm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help, much appreciated!