Tim Bannister wrote:
On 28 Jul 2007, at 07:30, Marc Jacobs wrote:I need to create 1 virtual host that runs multiple sites (siteA.com) & siteB.com) located at different paths in the host.…See the part of httpd.conf that relates to this virtual host: <VirtualHost *:80> DocumentRoot /var/www/vhosts/sites/httpdocs ServerName sites ServerAlias siteA.com www.siteA.com siteB.com www.SiteB.com RewriteEngine On# THIS IS NOT WORKING: this was intended to take you to the right path when you type siteA.com OR www.siteA.comRewriteCond %{HTTP_HOST} ^siteA\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.siteA\.com$ [NC]RewriteRule ^/var/www/vhosts/sites/httpdocs(.*) /var/www/vhosts/sites/httpdocs/siteA$1 # THIS IS NOT WORKING: this was intended take you to the right path when you type siteB.com OR www.siteB.comRewriteCond %{HTTP_HOST} ^siteB\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.siteB\.com$ [NC]RewriteRule ^/var/www/vhosts/sites/httpdocs(.*) /var/www/vhosts/sites/httpdocs/siteB$1</VirtualHost>Try this; it could be along the line of what you want: RewriteEngine On RewriteCond %{HTTP_HOST} ^siteA\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.siteA\.com$ [NC] RewriteRule ^/(.*)$ /var/www/vhosts/sites/httpdocs/siteA/$1 # and similarly for siteBIf you also use Alias directives, they might be affected by this. Check that errors (eg 404) still look right with the configuration in place.--Tim Bannister - +44 7980408788 - isoma@xxxxxxxxxxxxx ---------------------------------------------------------------------The official User-To-User support forum of the Apache HTTP Server Project.See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
I think rewrite* is overkill for this really. Although i've not messed around with ServerAlias, I usually just duplicate the VH entries with the appropriate ServerNames. I think it's easier to make mods to each individual site that way.
Long way... <virtualhost *> ServerName siteA.com ... </virtualhost *> <virtualhost> ServerName www.siteA.com ... </virtualhost> <virtualhost *> ServerName siteB.com ... </virtualhost *> <virtualhost> ServerName www.siteB.com ... </virtualhost> or simply try Short way... <virtualhost *> ServerName siteA.com ServerAlias www.siteA.com ... </virtualhost> <virtualhost *> ServerName siteB.com ServerAlias www.siteB.com ... </virtualhost>I'm still using the long way for now... no reason really other than i'm too lazy to change it. :)
Norm --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx