Cake php css load issue on apache2

2019-05-26 18:28发布

My css file is not loading.

I have just installed apache2 with php on ubuntu. (Mysql server already installed.)

I have placed fresh download of cake php from official site. But when I am trying to access it, CSS file is not loaded.

Here is the screen shot.

alt text

4条回答
戒情不戒烟
2楼-- · 2019-05-26 19:02

I would think telling him to read the instructions and setup requirements including the use of mod_rewrite would be a better solution than pointing him towards the no mod_rewrite method.

A quick google for mod_rewrite apache ubuntu brings up a ton of possibly useful information and will likely work out for him better than turning off one of Cake's key features.

查看更多
Deceive 欺骗
3楼-- · 2019-05-26 19:08

Try deleting these files:

 /.htaccess
 /app/.htaccess
 /app/webroot/.htaccess

and uncommenting this line on app/config/core.php [69]

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

EDIT:

to answer your comment: as far as I know, what this does is set the base url of the app to index.php (env() Gets an environment variable from available sources) That baseUrl is used to rewrite the urls without using mod_rewitte, with pathinfo.

查看更多
来,给爷笑一个
4楼-- · 2019-05-26 19:18

I've seen this issue when the .htaccess is missing from the root or from webroot. Usually, this occurs when adding files to svn and the .htaccess is not included.

查看更多
Lonely孤独者°
5楼-- · 2019-05-26 19:21

Just wanted to add

to enable mod_rewrite with apache on ubuntu

sudo a2enmod rewrite
查看更多
登录 后发表回答