0

我当前的自定义 PHP MVC 项目中有一个非常奇怪的问题。如果控制器方法名包含 show (fx show_album),apache 会抛出 404 page not found?

杜你有什么想法为什么会发生这种情况?

.ht 访问:

#mod_rewrite start
Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [QSA,L]
#mod_rewrite end

顺便提一句。它适用于 url 中的正常获取请求(如 index.php?controller=profile&action=show_album&id=1

4

1 回答 1

0

您的问题可能不是单词show,更有可能是下划线show_album- 您的模式htaccess与下划线不匹配。

尝试以下添加下划线的模式。

#mod_rewrite start
Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z_]*)/?([a-zA-Z_]*)?/?([a-zA-Z0-9_]*)?/?$ index.php?controller=$1&action=$2&id=$3 [QSA,L]
#mod_rewrite end
于 2013-10-03T13:20:01.623 回答