我有几页
http://localhost/template
像home.php,about.php,contact.php
在
http:// localhost / template / sr我的页面名称相同.
这是我的根.htaccess文件中的内容
RewriteEngine on
RedirectMatch 301 ^/$http://localhost/template/sr/
我的error.log文件报告:
[localhost/sid#923dd8][rid#dd70b0/initial] [perdir C:/xampp/htdocs/template/] pass through C:/xampp/htdocs/template/
[localhost/sid#923dd8][rid#ddd0c8/subreq] [perdir C:/xampp/htdocs/template/] pass through C:/xampp/htdocs/template/index.php
[localhost/sid#923dd8][rid#ddb0c0/initial] [perdir C:/xampp/htdocs/template/] pass through C:/xampp/htdocs/template/
[localhost/sid#923dd8][rid#ddd0c8/subreq] [perdir C:/xampp/htdocs/template/] pass through C:/xampp/htdocs/template/index.php
此设置不会重定向,我一直从根目录获取页面.
解决方法:
如果您尝试将页面重定向到子目录中的核心对应页面:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]+)/?$/template/sr/$1 [L]