【发布时间】:2015-01-20 15:08:36
【问题描述】:
我正在尝试使用.htaccess 将example.com/short 之类的url 别名为example.com/short.php,但是当我测试配置时,只有在我请求不存在的php 脚本时才会被重定向。例如:页面short.php 存在,但shor.php 还没有当我请求example.com/short 的页面时,我得到example.com/short 的404 页面,但是当我请求example.com/shor 时,我得到example.com/shor.php 的404 页面
我正在使用的.htaccess 是:
RewriteEngine on
RewriteRule ^s/([A-Za-z0-9-]+)/?$ short.php?code=$1 [NC]
RewriteRule ^([A-Za-z0-9-]+)/?$ $1.php [NC,L]
【问题讨论】:
标签: php apache .htaccess mod-rewrite redirect