Virtual hosting
Posted
by
H3llGhost
on Pro Webmasters
See other posts from Pro Webmasters
or by H3llGhost
Published on 2011-02-17T15:27:26Z
Indexed on
2011/02/21
23:34 UTC
Read the original article
Hit count: 241
apache2
|mod-rewrite
Hello,
I want to use domains like xxx.abc.domain.tld.
The xxx is my folder to access. I tried it with the rewrite rules, but I can't get it working, because I don't know how to get the part xxx from the SERVER_NAME into my RewriteRule.
This was my try:
UseCanonicalName Off
# include the IP address in the logs so they may be split
LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/vaccess.log vcommon
RewriteEngine On
# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower
## deal with normal documents first:
# do the magic
RewriteCond ${lowercase:%{SERVER_NAME}} ^.+\.abc\.domain\.tld$
RewriteRule ^(.*)$ /var/www/abc.domain.tld/[xxx-part]/$1 [L]
Perhaps there is a better solution.
In generally I want to create a dynamic login system with mod_auth_mysql and for each xxx is a seperate user database.
I would prefer the domain/address syntax abc.domain.tld/xxx, but I don't know how to realize it.
Thanks for any advices.
© Pro Webmasters or respective owner