.htaccess - Apache mod_rewrite infinite loop, cannot fix it -
my htaccess:
rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ([^/.]+)/([^/.]+)(.*) /application/?path=$1/$2$3 [l,qsa] rewriterule ^$ /application/?path=acfrontpage/getmainpage [l,qsa] rewriterule (.*) /application/index.php?path=$1 [l,qsa]
this line causes infinite redirect:
rewriterule (.*) /application/index.php?path=$1 [l,qsa]
but need if previous rules didn't match, redirect index.php file. how can it?
from logs doing this:
split uri=/application/?path=application/ -> uri=/application/, args=path=application/&path=application/&path=application/&path=application/&path=application/&path=application/&path=application/&path=application/&path=application/&path=application/
========================
@anubhava
i tried suggested reply , works except base of operations domain i.e.: http://example.com/
rewritecond
applicable next rewriterule
. tweak rules avoid rewrites existing file or directories:
rewriteengine on rewriterule ^$ /application/?path=acfrontpage/getmainpage [l] # skip rewrite files/directories rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewriterule ^([^/.]+)/([^/.]+)(.*)$ /application/?path=$1/$2$3 [l,qsa] rewriterule ^(.+)$ /application/index.php?path=$1 [l,qsa]
apache .htaccess mod-rewrite
No comments:
Post a Comment