问题描述
我想通过webroot目录 .well-known / acme-challenge为我的域创建SSL证书以进行验证。我正在使用共享主机,但无法访问apache配置文件,因此只能使用.htaccess文件。
I want to create SSL certificate for my domain via the webroot directory ".well-known/acme-challenge" for verification. I'm using shared hosting and I don't have access to apache configuration files, so I can only use .htaccess file.
问题是我无法访问通过浏览器使用 my.domain /。well-known / acme-challenge / 文件名地址从该文件夹中下载文件。即使我在此目录中有这些文件,也出现了404错误。
Problem is that I can't access files in this folder from browser using address "my.domain/.well-known/acme-challenge/filename". I'm just getting 404 error, even though I have these files in this directory.
因此,我想知道是否有任何规则,可以在.htaccess文件中使用该规则来从浏览器访问隐藏目录。如果您需要更多信息,请告诉我。
So I want to know, if there's any rule, which I could use in .htaccess file to gain access to hidden directories from browser. If you need more informations let me know.
推荐答案
假设您的主机允许覆盖,这可能有效:
Assuming your host allows overrides, this may work:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !.well-known/
RewriteRule "(^|/)\.(?!well-known)" - [F]
</IfModule>
这篇关于允许访问Apache服务器上隐藏目录中的文件(尤其是“ .well-known”文件夹)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!