Assume we have 2 domains.
www.my-domain.com
www.mydomain.com
As Standard, we have a redirection from .mydomain.com/ to .my-domain.com/ via
(mydomain.conf)
<Virtualhost *:80>
ServerName mydomain.com
ServerAlias mydomain.com *.mydomain.com
RewriteEngine on
RewriteCond %{HTTP_HOST} (.+\.)?mydomain\.com(\/.+)?$ [NC]
RewriteRule (.*) http://%1my-domain.com$2$1 [R=301]
</VirtualHost>
But now, due to backwards compability, we have one special URL "www.mydomain.com/special/task.php" which needs to be served directly and should not be redirected.
What i am trying to do ist something like this:
(mydomain.conf)
<Virtualhost *:80>
ServerName mydomain.com
ServerPath /special/
DocumentRoot /var/www/special/
</VirtualHost>
<Virtualhost *:80>
ServerName mydomain.com
ServerAlias mydomain.com *.mydomain.com
RewriteEngine on
RewriteCond %{HTTP_HOST} (.+\.)?mydomain\.com(\/.+)?$ [NC]
RewriteRule (.*) http://%1my-domain.com$2$1 [R=301]
</VirtualHost>
But this wont work. What am i doing wrong or is this even possible? What do i have to do differently?