I have got apache2 server with one virtual host. It is typo3 CMS. There are multiple pages:
foo.com -- DNS A record --> 32.32.32.32
|_ foo.com/bar/
|_ foo.com/baz/
Now I want to configure other domain (qux.com, also with A record to IP same as below) to redirect it to foo.com/baz/, for example when user put qux.com in browser I want him to see qux.com in address bar and foo.com/baz/ webpage. In order to do this I have put this configuration to file in sites-enabled:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^qux.com
RewriteRule ^(.*) http://foo.com/baz/ [P]
but it has no effect. What is a cause? How to configure it properly?
Edit: here is my vhost config:
<VirtualHost *:80>
ServerName foo.com
ServerAlias *.foo.com
ServerAlias qux.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^qux.com
RewriteRule ^(.*) http://foo.com/baz/ [P]
DocumentRoot /var/builds/stage
<Directory /var/builds/stage>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>