LoginSignup
4
5

More than 5 years have passed since last update.

CakePHP の webroot 以下のリダイレクトをなんとかしたい

Posted at

参照: http://blog.fusic.co.jp/archives/1459

http://example.com/test にアクセスすると

http://example.com/app/webroot/test/ にリダイレクトするのを何とかしたい。

~/app/webroot/.htaccess を改修する。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

↓ 改変

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
RewriteCond %{THE_REQUEST} "^(.+?) (.*?)/app/webroot/(.*?) (.+?)$"
RewriteRule ^(.*?)$ %2/%3 [R=301,L,NE]
</IfModule>
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5