Setting up cakephp in a subfolder on AWS
I have moved my cakephp site to a subfolder on AWS ubuntu machine. The site works, but the CSS, images and JS are not loading. I am getting 404 not found error.
Not Found
The requested URL /demo/css/mscrollar/jquery.mCustomScrollbar.min.css was not found on this server.
Urls only work with index.php.
Here is the htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /demo
RewriteRule ^media/(.*) http://%{HTTP_HOST}/files/timthumb.php?src=http://%{HTTP_HOST}/app/webroot/files/$1 [L,R=301]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Please, help
+3
source to share
1 answer
You need to create two htaccess files. One in the web court and one in the root path. What in the root (./.htaccess) should look like this (replace YOUR_PATH):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /YOUR_PATH
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
In the webroot folder (./app/webroot/.htaccess) it should look like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
0
source to share