【发布时间】:2017-02-04 16:09:00
【问题描述】:
我在访问具有相同起始 URL 名称的 URL 时遇到问题,如下所示:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^sections?$ sections.php [NC,L]
RewriteRule ^sections/?$ sections.php [NC,L]
RewriteRule ^sections/([0-9]+)/([a-zA-Z-.]+)/view?$ view_sections.php?id=$1&name=$2 [NC,L]
RewriteRule ^sections/([0-9]+)/([a-zA-Z-.]+)/view/?$ view_sections.php?id=$1&name=$2 [NC,L]
前 2 条规则有效,但后 2 条无效,它只是加载sections.php 而不是查看sections.php。当我使用 Wamp 时它可以工作,但是当我在线上传时它不起作用。是不是因为php和apache的版本?
我的 Wamp 版本:
Apache 版本:2.4.9
PHP 版本:5.5.12
主机版本:
Apache 版本:Apache/2.2.27
PHP 版本:5.6.14
如果问题是版本问题,那么有什么可能的解决方案让它在托管版本中工作?
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting