apache - How can I redirect existing *.phps with this mod_rewrite, too? -
i use following mod_rewrite redirect index.php, seems if .php file exists opened instead of redirected index.php. should change solve ?
rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^(data/|js/|styles/|robots\.txt) - [nc,l] rewriterule ^.*$ index.php [nc,l]
ps: know there plenty of examples redirect .php else, without creating new rewriterule if possible.
not sure trying achieve first 4 lines (they doing apache default). causing problem.
whole block should be
rewriterule ^(data/|js/|styles/|robots\.txt) - [nc,l] rewriterule ^/(.*)$ index.php [nc,l]
that send every except asset dirs index.php
if want actual http redirect, need
rewriterule ^/(.*)$ /index.php [r]
the following specific php, if that's you're interested in
rewriterule ^(.*)\.php index.php [nc,l]
Comments
Post a Comment