domain.com/anything/ to anything.domain.com

Using a single web hosting account to host multiple sites

domain.com/anything/ to anything.domain.com

Postby nchaso » Tue Sep 25, 2007 4:53 pm

I read earlier that is posible to create A dubdomain with .htaccess from a folder on my site.
my url is http://www.wsdcent.com/nzalang/ , i whant it to be like nzalang.wsdcent.com How do i do this trouhg .htaccess.

Thanks for you time.
nchaso
 
Posts: 5
Joined: Tue Sep 18, 2007 10:42 pm

Postby richardk » Wed Sep 26, 2007 1:57 pm

It requires more than mod_rewrite. Have you looked in your hosting pannel for an option to set up a sub domain?

For mod_rewrite to do it, first you need to set up DNS for the sub domain. Then you need to configure the server to send the sub domain requests to your document root (yopu'd have to ask your host, if they're willing to do that, they're probably willing to set it up without mod_rewrite). Then in a .htaccess file in your document root you would have
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Fix missing trailing slashes for site1.com.
RewriteCond %{HTTP_HOST} ^(www\.)?nzalang\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/nzalang%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

# Rewrite site1.com to /site1/.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?nzalang\.com$ [NC]
RewriteRule ^(.*)$ /nzalang/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 4 guests

cron