<filesMatch> Not Working ...What Am I Doing Wrong?

Mike01

Member
Jun 10, 2013
9
0
1
cPanel Access Level
Root Administrator
Hello,
I can't figure out what I'm doing wrong.

Using the Include Editor, if I place this code into either the "Pre Main Include" or "Pre VirtualHost Include" or "Post VirtualHost Include" sections (All Versions):

Code:
<filesMatch "^(wp-config\.php|license\.txt|readme\.html?)">
order allow,deny
deny from all
</filesMatch>
I should specifically *NOT* be able to see this file:
www.mydomain.com/wordpress/readme.html

...but I can...
(and, yes, I restarted Apache ...version 2.2.24)
This has worked perfectly on other Apache servers when placed into the httpd.conf file.


RELATED:
Also, directives like the following do not work for blog.myotherdomain.com (where... myotherdomain.com/blog is re-directed to the subdomain in the local .htaccess file)
...but it works correctly for www.mydomain.com/blog
Code:
<IfModule mod_alias.c>
 RedirectMatch 403 install\.php
</IfModule>
Note: I've tried it with and without the <IfModule> wrap and makes no difference either way.


What am I doing wrong?
Thanks!
-Mike
 

STS Admin

Well-Known Member
Jul 8, 2012
46
0
56
India
cPanel Access Level
Root Administrator
Your blog is in /wordpress folder so I think the code should be

<FilesMatch "^wordpress/(wp-config\.php|readme\.html|license\.txt)">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
 

quietFinn

Well-Known Member
Feb 4, 2006
1,222
87
178
Finland
cPanel Access Level
Root Administrator
Or remove the "^", i.e.:
<filesMatch "(wp-config\.php|license\.txt|readme\.html?)">
order allow,deny
deny from all
</filesMatch>