【发布时间】:2017-06-13 10:37:57
【问题描述】:
我试图通过将 webroot 指向我的 ftproot 中的特定子文件夹来保护 ftp 根
-root (sub.mydomain.com)
-index.html (for testing, this should not show)
-conf
-src
-public
-index.html (this should always show)
我尝试在 fptroot 中放置一个 .htaccess 文件,如下所示:
RewriteEngine On
RewriteRule ^$ /public [L]
我也尝试了几个不同的谷歌搜索,但我最终还是可以访问 root/index.html。
下面的这个实际上是根据需要重定向的,但是 /public_html/ 显示在浏览器中,这显然不是我想要的。
RewriteEngine On
RedirectMatch ^/$ /public/
下面这个做同样的事情
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) http://sub.mydomain.com/public [R=301,L]
我希望除了 root/public 之外的所有内容都对浏览者完全不可见。许多虚拟主机默认为您完成此设置,但我在这个项目中没有那么奢侈。
【问题讨论】: