1

I'm using a friendly url solution that i achieve with the following lines in VirtualHosts

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ script.php?$1

So i can have url's like http://example.com/something/something/else/other/things/

But how could i send a 404 status to the user who requests any url that has a folder starting with /. (it doesn't have to exist)

Example: http://example.com/.svn/this/should/be/404
Example: http://example.com/other/things/.cannot/access/here
Example: http://example.com/this/should/be/.denied

Examples that shouldn't be denied:

Example: http://example.com/t.his/is/ok

I've tried playing with FilesMatch and DirectoryMatch but this is more of a virtual path and i couldn't get it to work. Thank you for your help

Lekensteyn
  • 64,486
  • 22
  • 159
  • 192
Marius
  • 3,976
  • 5
  • 37
  • 52

1 Answers1

1

If I understand the question, you are looking to throw a 404 error anytime some tries to access a hidden or directory? If so the following will do so, though I can't say it works against no existent files.

RewriteRule "(^|/)." - [R=404,L]

HTML5 Boilerpplate has a very nice and well documented .htaccess file, I would recommend checking that out. http://html5boilerplate.com/