本文介绍了设置默认的Apache重写规则条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设置一个默认重写规则捕捉到任何不匹配的previous重写条目。我试过这样:
I want to set a 'default' rewrite rule to catch anything that didn't match the previous rewrite entries. I've tried this:
RewriteRule ^(.*)/?$ index.php?url=$1 [L]
但返回的输出是:
But the output returned is:
url = index.php
在理想情况下我要的是附上所有的GET值URL所以他们将被保存到我的网络日志。任何人有任何建议,如何解决这个问题?
Ideally what I want is to attach all the GET values to 'url' so they will be saved to my web log. Anyone have any suggestions how to solve this?
推荐答案
省略了常规的前pressions不必要的括号时,您可以:
Omit needless parentheses in regular expressions whenever you can:
RewriteRule .* index.php?url=$0 [L]
如果要排除的index.php:
If you want to exclude "index.php":
RewriteRule ^(?!index\.php).* index.php?url=$0 [L]
这篇关于设置默认的Apache重写规则条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!