Forum Moderators: phranque

Message Too Old, No Replies

DirectoryMatch and htaccess question

         

grahama

12:37 am on Dec 15, 2006 (gmt 0)

10+ Year Member



Why does the below in my htaccess give a server 500 error?
I am assuming that it is a syntax error as I am more than a little new
to DirectoryMatch and regex.

<DirectoryMatch "^/.*/\.svn/">
Order deny,allow
Deny from all
</DirectoryMatch>

many thanks in advance
g

jdMorgan

1:26 am on Dec 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



According to the documentation [httpd.apache.org], <DirectoryMatch> can only be used in server config and virtual host config contexts, and therefore is not allowed in .htaccess.

However, you can probably achieve the same function by using mod_rewrite, if your server configuration allows it:


RewriteRule \.svn/ - [F]

Precede that rule with

Options +FollowSymLinks
RewriteEngine on

if not already present in your .htaccess file.

Jim

grahama

6:17 am on Dec 15, 2006 (gmt 0)

10+ Year Member



thanks for htaccess tip and the code :)