WebFaction
Community site: login faq

Hi all,

Im new to Webfaction and would like to use the FilesMatch Directive through htaccess to reject any requests for files with names that include a particular string. I have the following in my htaccess file however the files are still being served.

<FilesMatch "^(whateverstring|whateverstring)\.php$">
deny from all
</FilesMatch>

Does any one have any idea why it is refusing to work, or how to get it to work correctly. Can something be done via php.ini? I would be very grateful for any help. Thanks.

asked 22 Dec '11, 04:54

Rick22
312
accept rate: 0%


Your FilesMatch directive should work.

Can you verify that you are not using a "Static only (no .htaccess)" kind of application, as those are being served from our frontend nginx webserver where htaccess files are not getting interpreted?

Also, check for any typos in your regular expression, or even in the filename of your htacess file.

permanent link

answered 22 Dec '11, 05:28

iliasr ♦♦
2.1k14
accept rate: 35%

I'm using a Static/CGI/PHP application. The documentation says that htaccess should work with this type, I have checked the expressions however still no luck. When I purposely insert an mistake error 500 comes up so i think the file is being read ok, All i have done with this app is set a document root and php.ini, along with some scripts that work fine. Could i have messed up configuration somehow? any other ideas on what I could do to figure out a solution? thanks.

(22 Dec '11, 06:12) Rick22

Hi,

The most likely reason is that your regular expression does not match the files correctly. If you open a ticket, we can take a look at it for you.

(22 Dec '11, 06:23) todork

Yep, Regex did not match correctly. Thanks all.

(22 Dec '11, 09:03) Rick22
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×75
×12
×2

question asked: 22 Dec '11, 04:54

question was seen: 6,091 times

last updated: 22 Dec '11, 09:03

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM