CakePHP folders in webroot get redirected to app/webroot/folder
In CakePHP you can access files in webroot via domain/file
For example the favicon.ico file located at app/webroot/favicon.ico can be accessed from
example.com/favicon.ico
Directories on the other hand seem to have a gotcha.
If I have a directory called blog in the app/webroot/, then as long as I try to access it like:
example.com/blog/
Then it works as expected. However if I try to access it without the trailing slash:
example.com/blog
Then it gets redirected to:
example.com/app/webroot/blog/
This is undesired. I woult rather .com/folder
get redirected to .com/folder/
开发者_如何转开发instead of .com/app/webroot/folder/
Is there a way to set this up?
If you installed wordpress blog and cakephp in document root, you need to replace .htaccess file script with below script:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/YOUR_WORDPRESS_DIR.*
RewriteCond %{REQUEST_URI} !-f
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/YOUR_WORDPRESS_DIR.*
RewriteCond %{REQUEST_URI} !-d
RewriteRule (.*) app/webroot/$1 [L]
What about using the Router::Connect for blog to redirect directly to the good page? Of course this is not an automatic routine but it mighthelp you.
More info : http://book.cakephp.org/view/945/Routes-Configuration
I suppose there might be a parameter in the config core files, have you already had a look there?
You could try the instructions here
精彩评论