Allowing to access files in hidden directories on Apache server (especially “.well-known” folder)

蹲街弑〆低调 提交于 2019-12-19 09:44:56

问题


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.

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.

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.


回答1:


Assuming your host allows overrides, this may work:

    <IfModule mod_rewrite.c> 
        RewriteCond %{REQUEST_FILENAME} !.well-known/
        RewriteRule "(^|/)\.(?!well-known)" - [F]
    </IfModule>


来源:https://stackoverflow.com/questions/50318630/allowing-to-access-files-in-hidden-directories-on-apache-server-especially-we

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!