I have a few domains that point to one webspace.
www.domain.com
www.domain1.com
www.domain2.com
domain.com points to webspace root. domains 1,2 are in /vhosts/dom1 and /vhosts/dom2 respectively.
I managed to do proper domain rewriting, like so:
.htaccess in hosting root folder
- Code: Select all
Options +Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/domain2/
RewriteRule ^(.*)$ /vhosts/domain2/$1 [L]
Each domain points to a proper folder. I'm happy with myself here.
The problem arises when I try to install some CMS demo. Let me showcase with 19-pages CMS. Code above allows to use subdirs without giving me pain.
www.domain2.com/demos/19-pages/
However, 19-pages has own .htaccess
- Code: Select all
RewriteEngine on
RewriteRule ^([-a-zA-Z0-9_]*)/?([-a-zA-Z0-9_]*)?$ /index.php?whatpage=$1&maybe=$2
This creates a loop and points to www.domain2.com/index.php
OK, I delete slash in front of index.php and it shows correct 19-pages index, but no images/css because they used absolute path to root, like so
/images/a.png
/style.css
I can edit files fixing paths everywhere but I belive that there is a solution through mod_rewrite. I imagine that I need to use RewriteBase or something alike.
Thank you.