试图隐藏.htaccess文件 [英] Trying to hide .htaccess file

查看:87
本文介绍了试图隐藏.htaccess文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图隐藏我的.htaccess文件,以便每个人都不能只在他们的浏览器中读出它。

I'm trying to hide my .htaccess file so everyone can't just read it out in their browser.

我的.htaccess文件位于此处:< a href = http://businessgame.be/.htaccess rel = nofollow> http://businessgame.be/.htaccess
如您所见,您仍然可以读出来

My .htaccess file is located here: http://businessgame.be/.htaccess as you can see you can still just read it out.

我尝试添加以下内容:

# secure htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>

以及

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

但似乎都没有用。这真的很奇怪。我在做错什么事吗?

But none of it seems to work. This is really weird. Am I doing anything wrong?

推荐答案

您只需遵循此示例代码来处理.htaccess文件...

You just follow this sample code for .htaccess files...

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
ErrorDocument 404 /404.php
</IfModule>
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(yourwebsite.com)(:80)? [NC]
RewriteRule ^(.*) http://www.website.com/$1 [R=301,L]
DirectoryIndex index.php       
order deny,allow
Header unset ETag
FileETag None

<FilesMatch "\.(jpg|png|gif|js|css|ico|swf)$">
Header set cache-Control: "max-age=572800, must-revalidate"
</FilesMatch>

这将为我们提供更多帮助.....

This would more help for us.....

否则,它将帮助您...

other wise it will help you...

  <Files ~ "\.html$">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Files ~ "\.css$">
Order allow,deny
Deny from all
Satisfy All
</Files>

否则它会很好地工作。我将在我的网站上检查此代码。

Else its will working well.. i `ll checked this code in my website.

  Options +FollowSymlinks
 # Prevent Directoy listing 
Options -Indexes
# Prevent Direct Access to files
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

谢谢...为您提供了机会...

Thank u....for giving opportunity post for you...

这篇关于试图隐藏.htaccess文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆