Re: help on apache mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.com
RewriteCond %{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.com
RewriteCond %{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 siteB

If 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



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux