0

I have a cakephp application running in local server (Ampps for mac). when I type the url in the navigator I can't see css and js files loaded. When I check the console I find these errors :

Failed to load resource: the server responded with a status of 404 (Not Found) /app/webroot/files/masque_maroc.geojson:1 Failed to load resource: the server responded with a status of 404 (Not Found) /maps/display_time_filter_box:1 Failed to load resource: the server responded with a status of 404 (Not Found) /maps/display_filter_box:1 Failed to load resource: the server responded with a status of 404 (Not Found) /maps/get_data:1 Failed to load resource: the server responded with a status of 404 (Not Found) /maps/categories_menu:1 Failed to load resource: the server responded with a status of 404 (Not Found) /maps/mobile_categories_menu:1 Failed to load resource: the server responded with a status of 404 (Not Found) 

I did some researches, I found that I had to edit my .htaccess files of /app and Applications/AMPPS/www/carte_drin folders, I also added another one directly in www folder.

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /Applications/AMPPS/www/carte_drin/app RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/(app/webroot/)?(img|css|js)/(.*)$ RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> 

Yet the error is still there

Some says that I have to delete all .htaccess files and uncomment

Configure::write('App.baseUrl', env('SCRIPT_NAME')); 

of app/config/core.php yet the erros perist I don't know what I'm missing. Your help would precious thank you!

1
  • RewriteCond %{REQUEST_FILENAME} !-f means that the following RewriteRule does not apply if a matching file exists. Please check if mod_rewrite is enabled in your environment. You could do so by placing phpinfo(); inside a PHP file on the server and search for mod_rewrite on the resulting page. If it is enabled, please post the contents of all .htaccess files, which CakePHP version you are using and where your JS and CSS files are located. Commented Oct 17, 2018 at 8:18

1 Answer 1

1

Make sure you set AllowOverride All correctly , Look at the following pic and double check your and make sure you are editing www path and VirtualHost is 127.0.0.1

Please make sure your Apache.conf is set correctly

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.