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've set a virtual directory in /etc/apache2/sites-available/default like so:

    Alias /lynx/ "/home/srv1100/"
    <Directory "/home/srv1100/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all

every file is accessible when I write I want that only files, which their extension is NOT "bsp" or "nav" and will be accessible. I can't put them in other directory.

Any ideas?


share|improve this question
up vote 1 down vote accepted

You can use Apache's mod_rewrite to do this.

RewriteEngine On
RewriteRule \.(bsp|nav)$ - [nocase,gone,last]
share|improve this answer
This is a GREAT idea, Thanks! – Alon Gubkin Feb 2 '10 at 16:55
Ahh, there anything you can't do? – baumgart Feb 2 '10 at 17:40

Please see the mod_autoindex documentation at

Check out the IndexIgnore directive.

share|improve this answer
This prevents the files from showing up in the autoindex, but does not prevent a user from typing in the filename on the URL line and downloading them. You can accomplish the latter via file permissions (or creative use of mod_rewrite). – voretaq7 Feb 2 '10 at 16:46
Yeah, I missed that :(. Use file permissions to do it quickly, mod_rewrite to do it correctly. Just as an aside, you may want to look at your architecture/design a little bit regarding these files. If you don't want people downloading them, then why are they in a webroot? If you're including them in pages then permissions are going to break your site and you'll have to use mod_rewrite. If they're not included in your content, then why are they there? Just some food for thought. – d34dh0r53 Feb 2 '10 at 16:54

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.