【发布时间】:2014-05-22 07:54:17
【问题描述】:
我想从 url 中删除目录以从 www.mysite.com/pages/test.php 转到 www.mysite.com/test.php
我试过了:
RewriteEngine On
RewriteBase /
# externally redirect /dir/foo to /foo
RewriteCond %{THE_REQUEST} pages/
RewriteRule pages/(.*)$ $1 [L,NC,R]
# internally forward /foo to /dir/foo
# WHAT GOES HERE?
它在 url 中显示 www.mysite.com/test.php 但页面没有加载!如果我删除 htaccess 代码,页面 www.mysite.com/pages/test.php 加载没有问题..
请帮我解决这个问题!非常感谢所有帮助!
【问题讨论】:
标签: php .htaccess mod-rewrite