![]() |
How to protect .htaccess Files ?
Hi,
how can I protect .htaccess Files, so they can?t be browsed in a Webbrowser directly. I read on several sites about how they say it should work but when I tried those, the .htaccess file was still directly accessible. Why is that ? For example: Code:
<Files ~ "^.*\.([Hh][Tt][Aa])"> Wolfseye |
Quote:
Preventing someone from viewing my .htaccess file The .htaccess file typically resides in your root directory and can be viewed through the web browser. Most of the time there is information contained the the .htaccess file that you don't want people knowing, like the rules for allowing or denying access. One way to prevent access to the .htaccess file is to disable access to that particular filename. You can add the following lines to your .htaccess file in the root directory to deny visitors from viewing all .htaccess files contained in your website: Code:
<Files .htaccess> |
Thats one of the things I tried, doesn?t work. I can still directly access the File in the Browser. Thats why I wonder.
This is my .htaccess File, or lets say part of it. Would be too many Bans in it to post here. ;) Code:
php_value memory_limit 64M |
Quote:
You need to make sure the code is like the one shown below not like your example, I know that works 100% on my site. Failing that it may be something that you'll need to take up with your host, as something is stopping you from adding this. Code:
<Files .htaccess> You can read up on htaccess files here http://httpd.apache.org/docs/1.3/howto/htaccess.html |
Are you sure you can browse the .htaccess file?
I've never heard of this what is your site url? |
I only have the one in the Site Root. And thats the contents of it above. htaccess files work good on my host, just that protection of the .htaccess File isnt working.
Thats all. |
Quote:
Here is a nice little htaccess creator for those of you that don't want to spend hours editting code http://www.htaccesseditor.com/en.shtml#a_fileList let us know how you got on tlwwolfseye, I'll keep searching for you :D |
As I said in the pm, I would contact your host and ask them
the htaccess file isn't generally viewable view the web |
Quote:
However, you can apply a bit more security to your .htaccess files by adding the following code: Code:
<Files .htaccess> Another thing which people forget to do is when they write a .htaccess file they save it as htaccess.txt and then you need to upload this to your root. When its there you need to rename it to .htaccess removing the .txt extension. I think the reason you can view your htaccess file is perhaps you still have the .txt or some other extension still attached :rolleyes: |
No, its is as it should be. .htaccess , no other extension. :) Thats why I wonder. And like i said, the other things in my .htaccess file work fine, just not the preventing to browse that file. But I will check with my hoster later.
Thanks. WOlfseye |
Quote:
|
Quote:
Quote:
|
Into the .htaccess File. I am now waiting for a reply from our Hoster. Might not be there before tomorrow that I here from him. I will post here when I know whats the issues.
--------------- Added [DATE]1243319257[/DATE] at [TIME]1243319257[/TIME] --------------- Ok, i found the issue by accident. Seems besides the Code:
<Files .htaccess> Code:
<Files *> Just a couple of minutes ago my hoster confirmed that, he says that the second <Files> setting will overwrite the first. |
I added-
Code:
<FilesMatch "\.(htaccess|htpasswd|htgroup)$"> |
I checked mine and I could see it. I had the same issue as post #13.
It does pay to read the forums! |
If you can see htaccess, I'd run far, far away from your host.
htaccess should be a system level protected file. If it's not, the server's security is in major question. |
All times are GMT. The time now is 02:17 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|