Hi,
I was asked to set up a redirection in apache, but I admit that I don't know a lot about redirection.
The situation:
example.com is hosted on an apache webserver, this also has quite a few directories beneath it like example.com/this example.com/that a.s.o. These subdirectories tend to change frequently, new ones are added, some change names or get deleted...
Now they want example.com to be redirected to another apache server (anotherexample.com), but NOT example.com/this example.com/that and so forth.
I have been reading trough the docs, and searching this (and others) forum, but until now, I can't say I have found the way to set this up. I'm also not sure what to use, mod_rewrite or mod_proxy (ProxyPass looks promising)
Option 1: mod_rewrite RewriteCond %{HTTP_HOST} ^example\.com$ [NC,OR]
RewriteRule ^(.*)$ [
anotherexample.com...] [R=302,L]
=> I'm having a hard time judging if this will have side-effects...
Option 2: ProxyPass ProxyPass / [
anotherexample.com...]
=> I'm not sure if ProxyPass accepts this, or if it can only do this for directories underneath. Can I also use regex here?
like e.g. ProxyPass /(.*)$ [
anotherexample.com...]
Because if this is possible, I can reverse the situation, swap DNS entries for example.com and anotherexample.com, and have the ProxyPass do it's magic the other way around: keep example.com local, and redirect all subfolders
Any hints are welcome!
Thanks already!