Forum Moderators: phranque
<VirtualHost _ip_:80>
ServerAdmin webmaster@example.com
DocumentRoot /home/example/public_html
ServerName www.example.com
ServerAlias *.example.com
ErrorLog logs/example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
now I am using this .htaccess for subdomains to work
rewriteEngine on
rewriteCond %{HTTP_HOST} .
rewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
rewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com [NC]
rewriteRule ^/(.*) /%1/$1 [L]
What I succeeded so far is that everything I type as a subdomain goes directly to the main domain.
If I have a sublfolder and I type subfolder.example.com/subfolder it goes to the existing subfolder. Now I don't know what I did wrong, but if somebody knows some tips it would be great.
System:CentOS
The domain is hosted on a GD dedicated server
[edited by: jdMorgan at 7:02 pm (utc) on July 15, 2007]
[edit reason] example.com [/edit]
Generally, there is no need to specify IP address and port number unless those differ between the vHosts, and specifying them often causes problems. See also the notes on invoking the default server when the requested hostname cannot be found.
Jim