0

I have to enhance an already developed cakePHP application and im new to cakePHP. I am trying to run this application on local XAMPP server. Application is functioning correctly but CSS files are not loading. I tried setting .htacces

<Directory />
    Options FollowSymLinks
    AllowOverride all
    Order deny,allow
    Allow from all
</Directory>

but it did not work. I found some other solutions on SO like

Cake php css load issue on apache2 and others

but im not able to fix it. Any help or guidance in right direction appreciated.

4

2 Answers 2

2

If that is the only code in your .htaccess file then the core CakePHP htaccess rules are missing. The code you have added to your .htaccess file may be being blocked by by apache, you need to change it in your apache config and make sure you have the cakephp .htaccess file unmodified from the cakephp download.

I found on Windows, sometimes when you copy files over from the downloaded zip from cakephp.org that the .htaccess files go missing so make sure you have them.

After that, ensure mod_rewrite is loaded in apache and then ...

Locate the apache configuration.. located somewhere like ...

/etc/apache2/sites-available/default

And make sure you add your code to the Directory listed as your web directory.. it needs to looking something like this ...

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer. but it is a windows machine. will /var/wwww work on it?
The actual directory location was just an example and needs to be your www or public/webroot directory. On my Windows machine in my httpd.conf I have this ... <Directory "c:/wamp/www/"> ... You probably have something similar.. search your httpd.conf file for <Directory and browse though, you will have a couple of instances of that tag.
1

Make sure your rewrite module is enabled

Open apache’s configuration file using your favorite text editor. The configuration file generally locates at:

{apache_dir}/conf/httpd.conf

If you are using XAMPP or WAMP package then you will find the file at:

{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf

Search for the following string:

#LoadModule rewrite_module modules/mod_rewrite.so

and uncomment it (remove the ‘#’ sign).

 LoadModule rewrite_module modules/mod_rewrite.so

Now search for another string AllowOverride None and replace it by AllowOverride All Finally save the changes, close your text editor and restart your apache server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.