The Blog

How to use Rewrite Module to redirect any subdomains to a folder Posted on

Here is a working example of redirecting all but www subdomains to one folder “/var/www/vhosts/sunset-station.com/httpdocs/new/sunset”

ServerAlias *.sunset-station.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.sunset-station\.com
RewriteCond /var/www/vhosts/sunset-station.com/httpdocs/new/sunset -d
RewriteRule ^(.*) /new/sunset/$1 [L]
This entry was posted in Uncategorized. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code