【问题标题】:extending a htaccess rewrite rule扩展 htaccess 重写规则
【发布时间】:2012-12-24 07:08:05
【问题描述】:

我的 htaccess 中有以下重写规则/条件:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^id([0-9]+)/?$ /profile.php?user_id=$1 [L]

结果是“example.com/id1”

现在我遇到的问题是,我需要在 URL 中添加一个 $_GET 参数有时,但实际上它们会被忽略,例如:

example.com/id1?section=video
example.com/id1?section=photo
example.com/id1?section=audio

也不行:

example.com/id1&section=video

是否有机会通过扩展 htaccess 规则来完成这项任务?请记住,URL 并不总是添加 $_GET 参数。

最好的问候!

【问题讨论】:

    标签: php .htaccess mod-rewrite url-rewriting get


    【解决方案1】:

    尝试使用QSA 标志

    RewriteRule ^id([0-9]+)/?$ /profile.php?user_id=$1 [L,NC,QSA]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-18
      • 2022-01-02
      • 1970-01-01
      • 2013-03-12
      • 2017-01-07
      • 2014-10-22
      • 1970-01-01
      • 2011-08-29
      相关资源
      最近更新 更多