【问题标题】:mod_rewrite gives me 404mod_rewrite 给了我 404
【发布时间】:2009-02-11 18:20:26
【问题描述】:

我想重写链接 index.php?page=entry&id=15&action=editentry/15/edit.
这就是我的 .htaccess 现在的样子:

# Turn the Rewrite engine on
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

# Rewrite rules
RewriteRule ^([^/]*)(/([^/]*)/?)([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L]

给我 404。

有什么问题?

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    括号太多。你可能感染了 Lisp。

    试试:

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

    【讨论】:

      【解决方案2】:

      这里有一个非常好的一页 mod_rewrite 备忘单:https://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-12-11
        • 2019-04-04
        • 1970-01-01
        • 2014-11-08
        • 2012-07-16
        • 1970-01-01
        • 2012-07-20
        相关资源
        最近更新 更多