tags:

views:

29

answers:

1

hi. I have a problem with two htaccess files that i have in a hosting at godaddy. I have multiple domains in the same hosting and therefore i usen htaccess which i found and which is working great:

RewriteEngine On
RewriteBase /

# To redirect www.site1.com to /site1/
RewriteCond %{REQUEST_URI} !^/site1/
RewriteCond %{HTTP_HOST} ^(www\.)?site1\.www\.
RewriteRule ^(.*)$ site1/$1 [L]

This is great because it redirects whoever goes to site1.com to /site1/ and i have the page for site1 in that directory. In fact i have this same three others domains and they work great (the folder is hidden in the url bar).

My problem is that i added a new domain (site2.com) which is Zend app. Therefore it has it's own htaccess for rewriting the url (for passing parameters in a nicer way in the url). For this one it doesnt works. In fact i am redirected BACK to / and i get a page /index.html which nobody is supposed to be able to get. Just to notice: the zend app's webroot is 'www':

The second htacess, inside /site2/www is

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

I don't know how is it going back. Aren't htaccess commands path relative ? why is it going back two levels (remember that it is in /site2/www and the file i'm getting is at /index.php (a test))

A: 

it is not relative it respect you RewriteBase from upper level where is / ... Just put in htaccess under site2

RewriteBase /site2/
jatt
Actually i had another error which turned out to be the one in this case: the second RewriteCond first htaccess file points to www\. which i added because of the www folder where zend's public site is. It was wrong (i don't fully know how nor why) but then the rule was not being applied and that's why i was getting the index on /. The www was to be added to the RewriteRule instead. That fixed it :) Thanks anyway.
Mr X Colombia