Mod-Rewrite
如何以類似於 Apache 的方式拒絕訪問 OpenLiteSpeed 中的文件夾?
我試圖拒絕訪問使用OpenLiteSpeed v1.4.2託管的網站的文件夾,但我遇到了麻煩。我認為
.htaccess
OpenLiteSpeed 不支持它,因此我無法將其中的文件放入.htaccess
文件Deny From All
夾中。假設我要隱藏的文件夾的絕對路徑是
/usr/local/lsws/Example/html/hideme
. 我嘗試將以下內容放入 OpenLiteSpeed 面板中虛擬主機的重寫規則中,但沒有運氣:<Directory ~/hideme> Deny from all </Directory> <Directory ~/hideme/(.*)$> Deny from all </Directory> <Directory /usr/local/lsws/Example/html/hideme> Deny from all </Directory>
有誰知道我可能做錯了什麼以及如何拒絕訪問此文件夾?
從OpenLiteSpeed 的開源 repo的 GitHub 鏡像中查看這個範例配置文件,配置似乎是這樣的:
context { uri /hideme/ accessControl { deny } location hideme/ }