Re: help on apache mod_rewrite

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

 



Hi everyone,

I have a problem with apache, perhaps you can help... I would be glad
if you did. I'm not an expert on the subject, so forgive me if I'm
sounding naive....

I need to create 1 virtual host that runs multiple sites (siteA.com) &
siteB.com) located at different paths in the host.

In order to achieve this:
- I've already configured DNS for these domains
- I've created a virtual host named: sites (/var/www/vhosts/sites/httpdocs)
- Under sites, I have 2 seperate directories:
- siteA and SiteB
- Now I want to configure apache so that, the virtual host will
resolve correct paths for each of these domains (siteA.com &
SiteB.com)
- However, no matter what I did in httpd.conf, the virtual host won't
resolve the right folders for these domains

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>


I think I'm making a mistake with the RewriteRule part, rather than
RewriteCond. I tried to understand these (.*)!$ stuff... But they're
not very intuitive, i'm afraid.

Thank for your time.

Cheers,


[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