Reputation: 3250
Is there a way to keep the webroot folder at the actual root?
To explain: what should I do to achieve a folder structure like this:
app/
cake/
css/
files/
img/
js/
plugins/
vendors/
With everything working as it should.
Upvotes: 1
Views: 4999
Reputation: 29546
You are doing mistake of exposing your code to public.
/project/
/project/app/
...
/project/css/
/project/js/
...
However if you still want to set /project/
as your webroot, place this into .htaccess
file
// /project/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app/webroot/index.php?url=$1 [QSA,L]
</IfModule>
Recommendation: You should stick to the default directory structure of CakePHP, because it's proven secure and best practice to do most kind of applications.
Upvotes: 5
Reputation: 8915
I understand you want your workflow to be simplified, with top-level access to the directories you use frequently. However, it isn't wise to have your main sourcecode inside the web root.
You can instead use symlinks to link to the static folders (css
, img
, js
, etc).
Upvotes: 1