Home > Uncategorized > subdomain finally

subdomain finally

May 18th, 2010

mediatemple dv add to the vhost.conf file of the (domain) the following works like a charm do not need to add to .htaccess:

make sure dns zone file has wildcard associated with it *.(domain).com

then vi /var/www/vhosts/(domain).com/conf/vhost.conf and add the following

ServerAlias *.(domain)\.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.(domain)\.com
RewriteCond /var/www/vhosts/(domain)\.com/httpdocs/%1 -d
RewriteRule ^(.*) /%1/$1 [L]

/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=(domain).com

stop the server /etc/init.d/httpd stop
restart the server /etc/init.d/httpd start

add subdomain folder to domain, ie. blog

add file index.php with following code <?php echo “hello”; ?>

in browser http://blog.(domain).com you should see hello

thanks to: bit.ly/9tHVD6

Categories: Uncategorized Tags:
Comments are closed.