php - Apache vhost rewrite goes wrong with existing folders -
i want vhost rewrite urls such as:
http://dev.example.com/cool/story/bro
to:
http://dev.example.com/index.php?url=cool/story/bro
unless specifying existing file such as:
http://dev.example.com/images/duck.png
it works fine when have url uses existing folder such as:
http://dev.example.com/images
it strangely redirects to:
http://dev.example.com/images/?url=images
when should rewrite to:
http://dev.example.com/index.php?url=images
here's current code:
<virtualhost *:80> servername dev.example.com documentroot /var/www/dev/public php_flag display_errors 1 php_value error_reporting 30719 <directory "/var/www/dev/public"> rewritebase / rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?url=$1 [l] </directory> </virtualhost>
i've been trying fix hours can't see problem, hope can help.
you'll want specify rewritecond paths existing directories in addition ones existing files.
rewritebase / rewriteengine on rewritecond %{request_filename} !-f [or] rewritecond %{request_filename} -d rewriterule ^(.*)$ index.php?url=$1 [l]
Comments
Post a Comment