View Single Post
Old 23rd January 2009, 08:44
Miguel Miguel is offline
HowtoForge Supporter
Join Date: Sep 2007
Location: Maasmechelen - Belgium
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default Rewrite condition


this should do the trick. I use to have gallery.mydomain.tld rather than mydomain.tld/gallery

RewriteEngine On
RewriteBase /
# Rewrite foo subdomain requests to foo subdirectory
RewriteCond %{HTTP_HOST} ^squirrel\.yourdomain\.tld
RewriteCond %{REQUEST_URI} !^/squirrel/
RewriteRule (.*) /squirrel/$1 [L]
Put this in the .htaccess in the root of yourdomain.tld.

Please note that the above works with the directory name. So if squirrelmail is installed in squirrel or squirrelmail you will need to use squirrel respectively squirrelmail. Renaming the directory to webmail or mail does the trick.

The is also a rule to redirect requests for yourdomain.tld/squirrel to squirrel.yourdomain.tld but I can't find for the moment.

Have fun.
Reply With Quote