htaccess重定向在cakephp中删除/ app / webroot

时间:2011-05-23 16:42:11

标签: .htaccess cakephp mod-rewrite redirect url-rewriting

我有一个htaccess文件,我想将所有页面重定向到另一个文件夹。我正在使用cakephp作为网站,除了我要重定向的这个文件夹。

“/ app / webroot /”已添加到新目录中,因此网址为/ app / webroot / new /而不是新目录。

我将这个htaccess文件(下面)放在“new”目录中,并希望/ app / webroot / new /中的任何内容重定向到/ new /并删除/ app / webroot /这个文件夹独立于cakephp和因此不需要用蛋糕加工。

下面的代码循环,我不知道为什么。

Options +FollowSymlinks
RewriteEngine On
RewriteBase /new/


# If your concerned about direct access to a particular page without the sub-dir 
# you will want to add something like this
RewriteCond %{REQUEST_URI} !^/new
RewriteRule (.*) /new/$1 [R=301,L,NC]

1 个答案:

答案 0 :(得分:0)

您不应将.htaccess文件放在/new/中,而应放在/app/webroot/new/中。

相关问题