Reputation: 13707
I am trying to setup my .htaccess
file to send the user to a separate folder on my webspace unrelated to CakePHP. It is unrelated to the logic of the site and mostly for testing, deployment hooks etc. so CakePHP routing is not what I'm after.
I want users who go to mysite.com/test
to access a /test
folder at the public html level that my hosting gives me (instead of looking for a TestsController
).
This is what I have in the root .htaccess
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^test/?$ test/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteRule ^$ app/webroot/ [L]
</IfModule>
And yet entering mysite.com/test
warns me
Error: TestController could not be found.
Error: Create the class TestController below in file: app/Controller/TestController.php
I thought RewriteRules
work top down with the [L]
ignoring subsequent lines. However this doesn't seem to be the case. Removing the app/webroot
references is the only way I can access the test/
folder (i.e ignoring CakePHP even exists).
What am I doing wrong here?
Upvotes: 0
Views: 346
Reputation: 1174
One option would be to use a RewriteCond on your cake app rewrite rule. Something like:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule (.*) app/webroot/$1 [L]
#RewriteRule ^$ app/webroot/ [L]
Upvotes: 1