Wildcard redirect for subdomains and URI
- by user1807680
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