【问题标题】:I can't access my $_GET array我无法访问我的 $_GET 数组
【发布时间】:2018-08-06 01:08:32
【问题描述】:

我想我已经用我的 .htaccess 文件吃掉了 $_GET 参数。这是.htaccess:

# Rewrite directory path to index.php?page=dir/dir/page
# Excludes any existing files so files can be called directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index\.php [NC]
RewriteRule ^([^/]+)(.*)?$ index.php?page=$1$2   [L]

这一直运作良好。但是现在需要给pages传一些参数,不知道怎么让参数通过rewrite rule。

我可以将这些参数视为超级全局 $REQUEST_URI 的一部分,如果需要,我可以对其进行处理。但想让我的 .htaccess 规则正常工作。

【问题讨论】:

    标签: .htaccess get


    【解决方案1】:

    我找到了答案。我需要将 QSA(查询字符串附加)标志添加到重写规则中。上面的重写规则现在是:

    RewriteRule ^([^/]+)(.*)?$ index.php?page=$1$2   [L,QSA]
    

    【讨论】:

      猜你喜欢
      • 2016-02-29
      • 1970-01-01
      • 1970-01-01
      • 2019-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-02
      相关资源
      最近更新 更多