FilesMatch in .htaccess file no longer working - .htaccess

I used to use this code on my old shared hosting, but have switched to a VPS, but it does not seem to work as intended.
<FilesMatch "\.(inc|log|exe|sql|ini|conf|bin)$">
Deny from all
</FilesMatch>
I'm trying to block access to these extentions, but if I type in a file that does not exist it still puts 403 forbidden and not 404 not found. Any idea why?
Thank you

Related

allow wget & php deny from rest

SetEnvIf User-Agent .*Wget* wget
Order deny,allow<br>
Deny from all<br>
Allow from env=wget
ErrorDocument 403 /403.shtml
So I am currently using the above lines of text inside my htaccess file, and it works perfectly. The problem is I need to allow access to a mailer.php file that is also listed in that directory.
Is there a way i can allow access to just this file and use the above code yet to block out the rest?
And if it matters, the phpfile writes to a file inside that directory... it is called rc3.key (not sure if that is important but i think it could be)
Just add the following:
<Files "mailer.php">
Allow from all
</Files>
This will allow everyone to access mailer.php but will throw a 403 error for every other file.

Apache2.4 htaccess - negative ifModule executes regardless

Consider the following Apache conf directives inside .htaccess:
ErrorDocument 403 /dbug.html
<IfModule !mod_php5.c>
Require all denied
</IfModule>
It denies access even though mod_php5 is active, but ignores the ErrorDocument
If i remove the ! it triggers the ErrorDocument 403 - which it should, but this is backwards, and wrong ..
Any answer/advice would be appreciated, thanks.
In some shared-hosting environments, live-module-version-switching (hot-switch) is available; as a result, the main module-name (module-handler) may be different than the target-module-name, but the target-module will show up as being present only when it is called by the module-handler.
The solution is to track down the name of the module-handler-name and reference that instead .. contact the hosting provider. In this case, the module-handler-name is: mod_php_null (Hetzner); so <ifModule !mod_php_null.c> will work as expected -BUT- to set directives for the target-module, use the target module-name; so then <ifModule !mod_php7.c> will work as expected.
If there is no "module-handler" for such a module, then referring the target module directly in both conditions should work as it gets loaded upon server daemon startup.
The question was also posted on Server Fault, to avoid duplication -the .htaccess code is posted there.

oscommerce allow running script independently on different folder

I have oscommerce installed on a domain (www.myoscommercesite.com), but now i want to run an independent script (www.myoscommercesite.com/myindependentscript) but getting a 404 message
I have tried adding this into htaccess file
<FilesMatch "\.(php)$">
Order Deny,Allow
Allow from all
</FilesMatch>
But problem still there
Thanks

Go Daddy 403 page

I tried to block an ip in the .htaccess, which I could do but I can't get the default 403 error to redirect to my custom 403 page. Anyone know how to do this?
ErrorDocument 403 /403/403.html
You might be denying access to the file when you block the IP in the .htaccess file.
Create another .htaccess file inside the 403 directory and in that .htaccess allow all from anyone. Then anyone should be able to see the custom 403.html page when they are blocked.
See if that will help your issue.
Update:
Here is an example.
Put the error document line in the root .htaccess file.
ErrorDocument 403 /403/403.html
Then in the .htaccess file inside the 403 directory add only this.
Order allow,deny
Allow from all
Browser Cache? http://pcsupport.about.com/od/browsers/f/clear-cache.htm
HTTP-Server restart (I don't know how it works by GoDaddy)
Is it the right path to the Error-HTML file? /403/403.html (try the absolute path?)
I figured it out
ErrorDocument 403 /error/403.html
order allow,deny
deny from xxx.xxx.xxx.xx
allow from all

.htaccess file is protecting all of my directories. How can I allow access to one?

I've got a folder on my server called dvd and I've put an index file in this folder. If i go directly to /dvd/index.html I can view the file. However, if I go only to /dvd/ I get a 403 forbidden error. I'm sure I can allow access to the /dvd/ folder but I can't figure out how. Below is the filesmatch code i'm using at the moment. Can someone please tell me what it is I'm supposed to be doing? Thanks
<FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>
Add
DirectoryIndex index.html
to the .htaccess, seems like it's not set if you can view it directly.

Resources