Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 www.mysite.com/images 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

1 Answer 1

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.