Cakephp无法加载CSS和JS文件

时间:2018-10-16 10:01:20

标签: cakephp

我有一个在本地服务器(适用于Mac的Ampps)中运行的cakephp应用程序。当我在导航器中键入URL时,看不到已加载的CSS和JS文件。当我检查控制台时,发现以下错误:

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)

我做了一些研究,发现必须编辑/ app和Applications / AMPPS / www / carte_drin文件夹的.htaccess文件,我还直接在www文件夹中添加了另一个文件。

<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>

但是错误仍然存​​在

有人说我必须删除所有.htaccess文件并取消注释

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

app / config / core.php,但是错误的坚持者我不知道我缺少什么。您的帮助将非常宝贵!

1 个答案:

答案 0 :(得分:0)

请确保您正确设置了AllowOverride All,看下面的图片并仔细检查一下,并确保您正在编辑www路径,并且VirtualHost是127.0.0.1

Please make sure your Apache.conf is set correctly