如何将所有请求重定向到 index.php 并保留其他 GET 参数? [英] How to redirect all requests to index.php and keep the other GET params?
本文介绍了如何将所有请求重定向到 index.php 并保留其他 GET 参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我到目前为止所得到的:
Here's what I've got so far:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?url=$0 [L]
但是当我去像 /a?b=c
这样的东西然后检查 GET 参数时,我只得到 a
的 url
,并且 b
丢失.我怎样才能保留它?
But when I go to soemthing like /a?b=c
and then inspect the GET params, I only get a
for url
, and b
is lost. How can I retain that?
推荐答案
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?url=$0 [QSA,L]
您的重写规则中需要 QSA.
You need the QSA in your rewrite rule.
这篇关于如何将所有请求重定向到 index.php 并保留其他 GET 参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文