【问题标题】:Mod rewrite and $_GET variableMod 重写和 $_GET 变量
【发布时间】:2012-03-15 13:52:12
【问题描述】:

我有一个非常简单的 mod-rewrite 规则:

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

作为一个例子,它将一个url www.mysite.com/a/b 转换为www.mysite.com?url=a/b

这里的问题是不允许将 get 参数传递给我的 php。

关于如何将www.mysite.com/a/b?bar=42&foo=43 转换为www.mysite.com?url=/a/b&bar=42&foo=43 的任何线索

提前致谢!

【问题讨论】:

    标签: php regex .htaccess mod-rewrite


    【解决方案1】:
    RewriteRule . index.php?url=$1 [PT,L,QSA]
    

    QSA = 查询字符串追加

    【讨论】:

    • 我使用了 RewriteRule ^(.*)$ index.php?url=$1 [PT,L,QSA],非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    • 2011-07-07
    • 1970-01-01
    相关资源
    最近更新 更多