loki_22 Posted May 18, 2008 Share Posted May 18, 2008 Hi, I need help setting up multiple vhosts. I've read the apache docs, but I'm still having trouble. I've set my dns with a wildcard, so all subdomains are mapped to my web server's IP. I've then setup a vhost as follows... #example.com <VirtualHost *:80> ServerAdmin me@example.com ServerName example.com UseCanonicalName Off VirtualDocumentRoot "/home/www/%2" ErrorLog /var/log/example.com-error_log CustomLog /var/log/example.com-access_log common DirectoryIndex index.php index.html index.htm #PHP Go! suPHP_Engine On </VirtualHost> I'm trying to catch the subdomain and use it to map to a directory. I've already accomplished this with mod_rewrite, but my users much prefer having vanity sub domains. So far any subdomain tries to map to the / directory and it throws a 403. Any help is much appreciated. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/106195-mod_vhost_alias/ Share on other sites More sharing options...
trq Posted May 18, 2008 Share Posted May 18, 2008 To use VirtualDocumentRoot you would need to have an existing directory (of the same name) for each subdomain to map too, is this the case? Quote Link to comment https://forums.phpfreaks.com/topic/106195-mod_vhost_alias/#findComment-544310 Share on other sites More sharing options...
loki_22 Posted May 18, 2008 Author Share Posted May 18, 2008 Yes, The idea is that lar.example.com maps to /home/www/lar and ken.example.com maps to /home/www/ken. These directories exist. Is the %2 right? for catching the subdomain part. I only need the subdomain to map to the correct folder. Regards, Quote Link to comment https://forums.phpfreaks.com/topic/106195-mod_vhost_alias/#findComment-544346 Share on other sites More sharing options...
loki_22 Posted May 19, 2008 Author Share Posted May 19, 2008 Anybody? Quote Link to comment https://forums.phpfreaks.com/topic/106195-mod_vhost_alias/#findComment-544574 Share on other sites More sharing options...
steviewdr Posted May 19, 2008 Share Posted May 19, 2008 Try %1 instead of %2. -steve Quote Link to comment https://forums.phpfreaks.com/topic/106195-mod_vhost_alias/#findComment-544905 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.