如何将所有请求修改重写为单个文件而不会导致无限循环 [英] How to mod-rewrite all requests to single file without causing an infinite loop
本文介绍了如何将所有请求修改重写为单个文件而不会导致无限循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将所有请求发送到www.myurl.com/{ANYTHING}并将其全部发送到www.myurl.com/index.php
How can I take all requests to www.myurl.com/{ANYTHING} and send them all to www.myurl.com/index.php
我发现我可以使用以下方式发送所有邮件:
I am finding I can send everything with:
RewriteRule .* index.php [R=Permanent,L]
这很好用,但由于安装了cpanel/apache,我被重定向到www.myurl.com/home/username/public_html.因此,我改为将代码更改为
This works great, except I am redirected to www.myurl.com/home/username/public_html because of my cpanel/apache installation. So instead I changed my code to
RewriteBase /
RewriteRule .* index.php [R=Permanent,L]
但这会再次导致无限循环.
But this causes the infinite loop again.
推荐答案
尝试:
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule .* /index.php [R=Permanent,L]
这篇关于如何将所有请求修改重写为单个文件而不会导致无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文