Rewrite rule looping indefinitely
I have strange problem with .htaccess I can't solve:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1
RewriteRule watermelonurltest wmelon/core/works.html
</IfModule>
When watermelonurltest is accessed, it loops to something like:
http://localhost/w/watermelonurltest/index.php/2/index.php/2/index.php/2/index.php/2/index.php/2/index.php/2/index.php/2/(...)
Which suggests that RewriteRule ^(.*)$ index.php?/$1
is applied instead of RewriteRule watermelonurltest wmelon/core/works.html
I tried to swap these two rules, but then other pr开发者_如何学Coblems like this one occur.
The problem didn't exist when the first rule was
RewriteRule ^(.*)$ index.php/$1
(no question mark after .php)
For some reason, this question mark breaks it.
I can't figure out why this happens and how to fix it - I tried googling a little, but I didn't find anything helpful.
Thanks in advance.
https://www.communitymx.com/content/article.cfm?cid=51C62&print=true
I attempted to reproduce this in a fresh setup, but using the .htaccess and rules provided, I didn't encounter a loop; the rewrite was to index.php?/watermelonurltest; confirmed by looking at the rewrite log.
What redirection does index.php do, if any?
精彩评论