Removing index.php from website URLs

后端 未结 1 507
离开以前
离开以前 2021-01-20 21:52

I am using the Kohana framework (but I think it\'s irrelevant for this question) and pages can be accessed like so

http://www.example.com/articles/
http://ww         


        
1条回答
  •  [愿得一人]
    2021-01-20 22:09

    Try this:

    RewriteRule ^index\.php/(.*) $1 [NS,NC,L,R=301]
    

    What you're not processing is that all requests are subject to rewriting, and when you do a rewrite it generate a subrequest -- which is also subject to rewriting. So you wind up rewriting /articles to /index.php/articles, then in the subrequest that that issue, you rewrite /index.php/articles to /articles and generate a new request for the 301 redirect, on and on. Adding the NS flag will make this rule not operate on subrequests, which I think should fix your problem, unless you're also doing a 301 on the /articles -> /index.php/articles rewrite (but that would be madness).

    0 讨论(0)
提交回复
热议问题