【发布时间】:2011-01-25 21:11:38
【问题描述】:
我正在使用 MySQL 的 Apache 服务器 (1.3.33) 上的 PHP (5.2.14) 工作,我们的 .htaccess 文件生成的漂亮 url 出现了问题。例如,www.example.com/pages/page 将工作,而 www.example.com/page/this-other-page 突然不再工作。如果我输入下划线,则 404 消失,但页面 uri 以破折号存储在数据库中,因此它返回“找不到页面”CMS 错误。
以下是划线中的重写规则。
RewriteRule ^([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/?$ page.php?module=$1&uri=$2 [L]
RewriteRule ^([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/?$ page.php?module=$1&uri=$2&sec_uri=$3 [L]
RewriteRule ^([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/?$ page.php?module=$1&uri=$2&sec_uri=$3&tri_uri=$4 [L]
我怀疑服务器上有一些不喜欢破折号的配置规则,但它不在我们的服务器上。客户在其他地方托管,他们的服务器管理员根本没有帮助。
或者是否有可能修复它的 php 配置规则?
【问题讨论】:
-
可能是您的 CMS 不喜欢网址中的破折号。
标签: php apache .htaccess configuration