Why does this mod_rewrite directive not work?
Due to a server migration, I'm attempting to direct all URI's starting
with /rc, /roundcube, /sm, or /squirrelmail to https://webmail.{HTTP_HOST}
using the following mod_rewrite code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
RewriteCond %{REQUEST_URI} ^/(rc|roundcube|sm|squirrelmail)(/)?(.*)?$
RewriteRule ^/(.*) https://webmail.%1 [R=302, L]
Because I want this redirection to affect all virtual hosts on the
machine, I'm putting it in the virtual host directive inside the
httpd.conf file of Apache.
The server does have mod_rewrite enabled, but this above seems to do
nothing at all!
Perhaps someone can spot my error?
An example of the intended result is:
http://www.mydomain.com/rc --> https://webmail.mydomain.com
It should be able to handle the task with or without the www or the
trailing / and maybe parameters included when users bookmarked the
original URL.
No comments:
Post a Comment