本文介绍了试图隐藏.htaccess文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正试图隐藏我的.htaccess文件,以便每个人都不能只在他们的浏览器中读出它。I'm trying to hide my .htaccess file so everyone can't just read it out in their browser.我的.htaccess文件位于此处: http://businessgame.be/.htaccess 如您所见,您仍然可以读出来My .htaccess file is located here: http://businessgame.be/.htaccessas you can see you can still just read it out.我尝试添加以下内容:# secure htaccess file<Files .htaccess>order allow,denydeny from all</Files>以及<FilesMatch "^\.ht">Order allow,denyDeny 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 OnErrorDocument 404 /404.php</IfModule>Options -IndexesRewriteEngine onRewriteCond %{HTTP_HOST} ^(yourwebsite.com)(:80)? [NC]RewriteRule ^(.*) http://www.website.com/$1 [R=301,L]DirectoryIndex index.php order deny,allowHeader unset ETagFileETag 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,denyDeny from allSatisfy All</Files><Files ~ "\.css$">Order allow,denyDeny from allSatisfy 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 SettingsRewriteEngine 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} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{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文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 08:46