的.htaccess重写505错误循环 [英] .htaccess Rewrite 505 Error Loop
本文介绍了的.htaccess重写505错误循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图改写:
mydomain.com/category.php?id=cat
mydomain.com/category.php?id=cat
到
mydomain.com/cat
mydomain.com/cat
我使用了下列的.htaccess code,但它一直显示505错误:
I have used the following .htaccess code but it keeps showing a 505 error:
RewriteEngine On
RewriteRule ^([^/]*)$ /category.php?id=$1 [L]
我读到另一页,这是因为在页面不断循环的,但我不知道如何我可以修复code。
I read on another page that it is because the page keeps looping, but I can't work out how I can fix the code.
推荐答案
请您的规则是这样的:
RewriteEngine On
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /category.php?id=$1 [L,QSA]
这篇关于的.htaccess重写505错误循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文