【问题标题】:.htaccess and forwarding the GET/POST parameters in PHP.htaccess 并在 PHP 中转发 GET/POST 参数
【发布时间】:2012-12-20 08:43:21
【问题描述】:

.htaccess 不转发 GET/POST 参数有问题..

这是我的 .htaccess :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L]

但是当我做类似的事情时:

mywebsite.com/url1/url2?action=delete&id=2

它将我重定向到:

mywebsite.com/index.php?a=url1&b=url2

所以它会删除 action=delete&id=2 而我在 $_GET 中什么都没有,有什么办法吗?

提前致谢。

【问题讨论】:

  • index.php之后的查询应该如何?
  • 你试过thisthis吗?

标签: .htaccess mod-rewrite


【解决方案1】:

使用QSA(如查询字符串追加)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L,QSA]

【讨论】:

  • 欢迎您。我回来了,请将其标记为答案。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-23
  • 2013-12-07
相关资源
最近更新 更多