gpt4 book ai didi

file - 试图隐藏 .htaccess 文件

转载 作者:行者123 更新时间:2023-12-04 14:42:51 25 4
gpt4 key购买 nike

我正在尝试隐藏我的 .htaccess 文件,这样每个人都不能只在浏览器中读取它。

我的 .htaccess 文件位于:http://businessgame.be/.htaccess如您所见,您仍然可以将其读出。

我尝试添加以下内容:

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

还有

<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]

感谢您....为您提供机会帖子...

关于file - 试图隐藏 .htaccess 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11831698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com