mod_rewrite的期待一切的index.php的PARAMS [英] Mod_rewrite forward everything to index.php 's params
本文介绍了mod_rewrite的期待一切的index.php的PARAMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能得到什么,但文件重写的index.php的PARAMS?我使用了Apache,mod_rewrite的,等等。
How can I get anything but files to rewrite to index.php's params? I'm using apache, mod_rewrite, etc.
推荐答案
如果您想重写任何不是一个普通的文件我用这个请求:
If you want to rewrite anything that isn't a request for a regular file I'd use this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/index\.php -f
RewriteRule ^(.*)$ /index.php?page=$1 [QSA]
</IfModule>
这样,您就不必担心自己关于坚持为你重写某个URL格式 - 您可以测试并在服务脚本采取相应的行动。
This way you don't need to concern yourself about adhering to a certain URL format for your rewrites - you can test and act accordingly in your serving script.
这篇关于mod_rewrite的期待一切的index.php的PARAMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文