【问题标题】:htaccess mod rewrite slash issuehtaccess mod重写斜线问题
【发布时间】:2012-05-12 19:35:18
【问题描述】:

我设法将 mydomain.com/file.php?id=## 重写为:

mydomain.com/##-Report_TITLE_OF_REPORT_HERE

通过让 .htaccess 只使用 ## 并忽略它之后的任何内容。我想把它改成这样:

mydomain.com/report-##/TITLE_OF_REPORT_HERE

但是,我无法理解它,也无法在网上找到任何针对此特定案例的教程。中间的斜线似乎把一切都搞砸了。

谁能告诉我怎么做?

【问题讨论】:

  • 你目前使用的是什么重写规则?

标签: php .htaccess url mod-rewrite rewrite


【解决方案1】:

试试这个:

RewriteRule ^report-(.*)/(.*)$ mydomain.com/file.php?id=$1 [L]

【讨论】:

【解决方案2】:

您可以使用此代码:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^report-([^/]+)/ file.php?id=$1 [L,NC,QSA]

【讨论】:

    猜你喜欢
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-03
    • 1970-01-01
    相关资源
    最近更新 更多