Wildcard redirect for subdomains and URI
Posted
by
user1807680
on Stack Overflow
See other posts from Stack Overflow
or by user1807680
Published on 2012-11-08T23:39:11Z
Indexed on
2012/11/09
5:01 UTC
Read the original article
Hit count: 338
I have a problem with create pernament (301) redirect in apache:
I have 2 domains:
olddomain.com
with many subdomains
newdomain.com
and I want to do redirect like:
if user enter on http://anysubdomain.olddomain.com
should be redirected to http://anysubdomain.newdomain.com
if user enter on http://olddomain.com/something
should be redirected to http://newdomain.com/something
if user enter on http://olddomain.com/different/index.html
should be redirected to http://newdomain.com/different/index.html
if user enter on http://example.olddomain.com/ex/index.html
should be redirected to http://example.newdomain.com/ex/index.html
I don't know how I should set this:
<VirtualHost *:80>
ServerName olddomain.com
</VirtualHost>
Regards
© Stack Overflow or respective owner