I have a Zend Framework application with a .htaccess
file in the root directory, directing all traffic to the /public
directory, where index.php
resides.
This is the contents of the .htaccess
:
RewriteEngine On
RewriteRule ^.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/(upload|img|js|css|less)/.*$
RewriteCond %{DOCUMENT_ROOT}/public/upload%{REQUEST_URI} -f
RewriteRule ^(.+.(jpg|png|mp3))$ /public/upload%{REQUEST_URI} [NC,L]
;RewriteCond %{REQUEST_URI} !^/public/.*$
;RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
As you can see, there are two commented out lines.
The section, supposedly directing traffic to /public
, and which works on my local servers and my shared host, seems to fail miserably on my client's server.
So, with the two lines commented out, when I type the site's address in the browser, I get a directory listing. When I append /public
to the address, I'm taken to /public/index.php
, as expected, but since the request wasn't redirected correctly, neither are the ones to the JS and CSS files.
When I uncomment the lines, I get a 500 internal server error (index.php
is not reached at all).
The other rewrites work correctly (at least as far as I can tell).
Any ideas why this would happen and how to correct this?
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…