Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

My .htaccess file from my root web server is:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

When i access or /javascript, the directory layout is showed, and all my images and assets are displayed. My application entry script is index.php. How can i deny this access?


share|improve this question

I do not know if .htaccess or mod_rewrite is the best tool for this task.

You can do several things. Since you are using php, try putting the following code in index.php in each of your sub-directories ( javascript/index.php )

<?php header( 'Location: /' ) ; ?>
share|improve this answer

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.