Recently I moved my websites to new hosting provider (share hosting). I have few domains and I'm using subdomains as well. Because websites use some common components I tend to have one copy of those libraries and sym-link them into every website's folder. So that whenever I update them all websites use fresh version.
Anyway on my previous hosting account I could point every domain or subdomain to its own folder and I had ability to link folders which were above (in hierarchy) website's folder. On new account I'm not able to do that. So the only way to maintain my system is to point all domains to account's root dir and use mod_rewrite from there. I have manage to do so, but some requests fail. This is my folders structure and then mod_rew file
- Code: Select all
root
website1
mainpage
sub1
website2
mainpage
sub1
sub2
....
website3
....
Here's a piece of my .htaccess file, located in root folder:
- Code: Select all
RewriteEngine On
#### domain1.com
RewriteCond %{HTTP_HOST} ^(www\.|)domain1\.com$ [NC]
RewriteRule ^ /website1/mainpage%{REQUEST_URI} [L]
#### sub1.domain1.com
RewriteCond %{HTTP_HOST} ^(www\.|)sub1\.domain1\.com$ [NC]
RewriteRule ^ /website1/sub1%{REQUEST_URI} [L]
#### domain2.com
RewriteCond %{HTTP_HOST} ^(www\.|)domain2\.com$ [NC]
RewriteRule ^ /website2/mainpage%{REQUEST_URI} [L]
......
I have a lot redirects which look like '/dir/file.php' within my websites, which now seem to fail.
Maybe I missed something. Any one knows better domains handling?
I tried also this:
RewriteCond %{HTTP_HOST} ^(www\.|)domain1\.com$ [NC]
RewriteRule ^(.*)$ /website1/mainpage/$1 [L]
which resulted Error 500
Thanks in advance