I need your help guys.
I have a server running Apache 2 and in there I've multiple vhosts bound to different domains. I want that the default vhost (so every address not bounded with a vhost) redirects to one of this domain, call it maindomain.com. Previously, I put in the default vhost config a redirect to maindomain.com and everything was working fine.
The problem is that now I changed the hostname of the system (I had to do that!) to maindomain.com. So, if I understood correctly, now maindomain.com is implicitly the default domain (infact I fell in a redirect loop issue).
I fixed this issue by setting maindomain.com location as default vhost. Things work but I get no redirect. If you, for example, visit www.maindomain.com (or any address not bound with a vhost) you visualize the correct site but in address bar you still see www.maindomain.com and NOT maindomain.com.
So, how I can fix this avoiding redirect loops?
- Is it possible to disable the fact that the hostname behaves like default vhost in Apache?
- Or, alternatively, how I can display maindomain.com in the address bar when someone connects using another address?
I hope that you can help me out, thanks in advance.