Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having hard time with .htaccess directive. I'm trying to have URL rewriting for Codeigniter framework.

Everything works as expected on the production server but i'm not able to set up properly my own testing server.

Testing server:

url rewriting works great, php files are rendered as expected, but all files included via HTML (css, js, img) are not displayed as they are not accessible due to:

403 Forbidden
You don't have permission to access /path/to/file/plugins-min.css
on this server.

here is my .htaccess file:

RewriteEngine On

# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For requests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

this is the apache2 configuration for my document folder:

<Directory /document/folder/>
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    AllowOverride All
    Order deny,allow
    Allow from all

when i set AllowOverride to None i.e. not rewriting urls static files are corectly shown.

When images are uploaded via script they are shown on the page even if them have the same permissions/owners/groups of the other files which are not accessible.

Everything has the same permissions and owners on the site.

I hope my question is clear enough and I'm looking for a way to make everything works as expected.

I think my apache configuration has something which prevent the 'included Html' files to be accessible as the apache's error log says:

[Wed Aug 17 22:29:24 2011] [error] [client <MY IP>] client denied by server
configuration: /var/www/, 
referer: http://<MY IP>/

Thanks in advance

share|improve this question
Is it possible you have another .htaccess somewhere in the path that is causing grief? – polynomial Aug 25 '11 at 18:18
@polynomial: I did look better to my folders and actually there where .htaccess files bothering out there. If you post an answer you'll get the bounty! – Dalen Aug 28 '11 at 13:50
cool glad that helped! – polynomial Aug 28 '11 at 14:05
up vote 1 down vote accepted

It is really common when using AllowOverride All to find .htaccess files in other directories above where you are working that impact your configuration. Per the comment thread posting this answer to collect the bounty. Here is an example find command:

find DocumentRoot -name .htacccess -print

Will print any other .htaccess files.

share|improve this answer

Find all the .htaccess files with:

find /var/www/ -name .htaccess

As a temporary, change:

Order deny,allow
Allow from all


Order allow,deny
Allow from all

to ensure that there is no Deny rules processed before.

share|improve this answer

Add following rules to Apache configuration inside section:

Allow from
Allow from localhost
share|improve this answer
Hi @Reza, I did try your soluton but it did't solved the issued. Allow from Alldoesn't already include loopback and localhost? – Dalen Aug 27 '11 at 22:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.