【问题标题】:Mod Rewrite duplicating queryMod Rewrite 重复查询
【发布时间】:2013-01-13 15:29:32
【问题描述】:

我正在尝试重写一个页面,但我得到一个重复的查询。

http://www.website.com/settings/index.php?page=account

改写为:

http://www.website.com/settings/account

所以我的问题是,当我在页面上使用服务器验证时,我重定向到 settings/account?valid=failed但不幸的是我得到了:

http://www.website.com/settings/account?valid=false&page=account

这是我的重写代码:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([A-Za-z0-9-]+)?$ index.php?page=$1 [L,QSA]

【问题讨论】:

  • 你希望它是什么样子的?
  • 抱歉应该加上那个。它应该只是:http://www.website.com/settings/acount?valid=false
  • 您的问题出在 PHP 内部,而不是 htaccess。
  • 那么您对我应该如何构建用于验证的重定向 url 有什么建议吗?我试过$SERVER['REQUEST_URI']."?valid=false"htmlentities($SERVER['REQUEST_URI']).?valid=false 但结果还是一样。

标签: php url mod-rewrite url-rewriting


【解决方案1】:

错误出现在 php.ini 文件中。 mod重写不是问题。

【讨论】:

    猜你喜欢
    • 2013-11-15
    • 2014-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-06
    • 1970-01-01
    • 2019-02-03
    相关资源
    最近更新 更多