我正在尝试隐藏我的 .htaccess 文件,以便每个人都无法在浏览器中读取它。
我的 .htaccess 文件位于此处:http://businessgame.be/.htaccess如您所见,您仍然可以将其读出。
我尝试添加以下内容:
# secure htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
and also
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
但似乎都不起作用。这实在是太奇怪了。我做错了什么吗?
您只需按照 .htaccess 文件的示例代码进行操作...
<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>
这对我们来说会更有帮助......
否则它会帮助你...
<Files ~ "\.html$">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Files ~ "\.css$">
Order allow,deny
Deny from all
Satisfy All
</Files>
否则它会工作得很好..我会在我的网站上检查这段代码。
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]
谢谢你....给你机会发帖...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)