Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter include js,css files from application returns 403 forbidden

I am having a problem loading a javascript or css or any other file from inside the application/modules directory.

I am using MAMP and CodeIgniter with HMVC and trying to have a js and css folders inside a module folder. Then when I am calling the controller methods I am also loading the asset files.

I have other sites that are working in that way. The structures are the same and the CodeIgniter versions are the same. Basically I have copied the previous website and started from there.

But it always returns 403 forbidden.

What I did but still nothing changes:

  1. the whole site directory is writable and readable.
  2. I can create and read new files from PHP to that dir
  3. I have htaccess file which I tried to remove or change
  4. Reinstalled MAMP
  5. Tried to open a simple html file
  6. The MAMP user and group has full access to the dir
  7. I tried to run the website on another server

The apache log says "[Tue May 22 17:24:30 2012] [error] [client 127.0.0.1] client denied by server configuration"

Here is the .htaccess file:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]

At the same time everything is fine with the other site.

I have spent many hours so far and I am stuck.

Any thoughts or suggestions are appreciated.

Thanks,

like image 807
Tihomir Mihaylov Avatar asked Jan 16 '23 14:01

Tihomir Mihaylov


1 Answers

CodeIgniter comes with a .htaccess in the /application directory which contains

Deny from all

You'll need to remove this file or change it's ruleset to access js/css files etc from anywhere inside application/*

It is however largely inadvisable to allow access entirely to the application, it's perhaps best to modify this .htaccess file to allow access to application/modules/*/css|js/

like image 183
Ben Swinburne Avatar answered Jan 30 '23 21:01

Ben Swinburne