php - htaccess block access to directory but allow access to files -
i have such situation. i'm developing application in zend framework , htaccess pointing every request index.php. if file or directory exists on request path htaccess allow access files css, js, images etc...
now have example such link:
example.com/profile/martin-slicker-i231
with zend router points controller account , action viewprofile. want add avatart users , created directory in public folder (so images accessible server css , js). directory named "profile" , subdirectory in "martin-slicker-i231". path visible server that:
public/ .htaccess index.php profile/ martin-slicker-i231/ avatar-small.jpg
the problem when point browser example.com/profile/martin-slicker-i231 points me directory not controller , action. when remove folder user flow go controller , action. how configure .htaccess example.com/profile/martin-slicker-i231 pointing controller , action request example.com/profile/martin-slicker-i231/avatar-small.jpg point file. here .htaccess
rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l]
can help?
just remove portion says should serve directories:
rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l]
now serve files (with size > 0) , symbolic links directly, send directory references , other urls application
Comments
Post a Comment