Forum Moderators: phranque
/etc/apache2/httpd.conf:
RewriteEngine on
Options Indexes FollowSymlinks Multiviews
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/etc/apache2/vhost.map
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{HTTP_HOST} !^$
RewriteCond ${lowercase:%{HTTP_HOST}¦NONE} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1
/etc/apache2/vhost.map:
www.domain1.com /home/user1/public_html/www.domain1.com
mail.domain1.com /home/user1/public_html/mail.domain1.com
www.domain2.net /home/user2/public_html/www.domain2.net
subdomain.domain3.org /home/user3/public_html/subdomain.domain3.org
So, I make changes in my vhost.map file "with hands" as root now. I need to make an web interface for users, that they will add for example "subdomain2.domain3.org /home/user3/public_html/subdomain2.domain3.org" in vhost.map file.
What is the easiest and secure way? I think, that I can do this with PHP (fopen vhost.map) or store all vhost map information in database, but apache can`t connect to mysql.
What is your offer?
This is a complex subject, with most of the work outside the scope of pure Apache-server. Therefore, I can only generalize an approach.
Jim