What is causing '403 Forbidden' on few links?

My app was running okay till yesterday, when I started working on removing index.php from my URLs. I’ve noticed a very weird behavior with my app while doing this. Now, I have my .htaccess file in place but not yet made ‘AllowOverride All’ in my .conf file. Till this point, the home page opens correctly, with all the css and javascript. But of course, the other URLs return the error ‘Not Found’ because I am yet to make the ‘AllowOverride’ change.

So, to make everything work (without the index.php in the URLs), I go ahead and change ‘AllowOverride None’ to ‘AllowOverride All’ in my .conf file. This makes all the pages working, with all the URLs clean, without index.php in them. But, the problem is, my css files are not loading. I checked web console and it says ‘403 Forbidden’ on three css files. Here’s a screenshot,

I’ve done everything I could to make this work. Tried making small tweaks to the conf and restarted the server each time while testing. Nothing works. When I take ‘AllowOverride All’ back to ‘AllowOverride None’, everything loads perfect along with css files. But, again, other pages don’t open with the new clean URL. I really don’t understand what I’m doing wrong.

Few key things,

I’m doing all of this on my localhost.

I never encountered this behavior while developing the same app on Snow Leopard. I’m on Mac OS X Lion now. Maybe it has to do with this.

I’m editing the .conf file under /etc/apache2/users named ‘user.conf’ (where ‘user’ is my username on the mac). I did this because editing (changing allowoverride) in the main httpd.conf under /etc/apache2 does not make my URLs work without index.php. I saw on some forum that making changes in user.conf inside /etc/apache2/users helps better.

Hoping to get this one solved soon, since it might affect all apps’ behavior on localhost.

i always do this task like follow

uncomment urlManager component from default configuration array and then i add this property to urlManager array

'showScriptName' => false,

to be :



  'showScriptName' => false,







and copy this to .htaccess

RewriteEngine on

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php

RewriteRule . index.php

that is it, i hope this will solve your problem

No, No! You’re not getting it. I know the rules that you pointed out. The problem is only with this app. Only the three css files inside the css folder of this app return ‘403 Forbidden’. I’m still trying to find out why.

sorry my mistake, i red your post in hurry.

i see the image and check url then i get what you mean (i guess).

Yii says that the themes folder should be located in accessible folder in web and you have to protect view folder inside themes, so check your project arround themes folder (also check parents and child folders till css folder) to see if there is any auto-generated .htaccess that contains

deny from all

i faced this 403 error before and the above is what was causing the problem.

Hey, that solved the problem. Thanks! Don’t know why I didn’t notice that .htaccess file inside the themes folder. :expressionless:

Anyway, I have a question related to this. If the .htaccess file containing ‘deny from all’ was inside the themes folder, how come other files were loading properly? Like the js files, images, etc? The were all inside other folders inside themes folder. There needs to some explanation to this.