I have multiple domain names pointing at one Apache2 virtual host:
ServerName domain1.com
ServerAlias domain2.com
ServerAlias domain3.com
To always display the same url I use a rewriterule like this:
RewriteCond %{HTTP_HOST} !^domain1.com [NC]
RewriteRule (.*) http://domain1.com/$1 [R=301,QSA,L]
Finally I have a alias like this:
Alias /niceurl /long/path/to/index.php
Everything works as fine, except that when a user visits domain2.com/niceurl/foo
, the url displayed in the browser will be domain1.com/path/to/index.php/foo
, rather than domain1.com/niceurl/foo
I should add that the other cases work like expected, in other words:
domain2.com/foo => domain1.com/foo
domain1.com/shorturl/bar => domain1.com/shorturl/bar
Is there a clever way to achieve what I want? Thanks for any hints!
Solution is creating a symlink, if you have access to your document root: