1
什麼是最好的方式發送到您的網站的所有流量404頁?我目前正在網站上工作,並希望所有請求都只有404。我嘗試過使用htaccess文件,但是並沒有像這樣工作得太成功。另外,我希望訪問特定文件夾的流量仍然可以通過。發送所有流量404錯誤
什麼是最好的方式發送到您的網站的所有流量404頁?我目前正在網站上工作,並希望所有請求都只有404。我嘗試過使用htaccess文件,但是並沒有像這樣工作得太成功。另外,我希望訪問特定文件夾的流量仍然可以通過。發送所有流量404錯誤
正如您的問題所述,最簡單的方法是將所有內容移動到該文件夾中。
但是,在行之間讀取它聽起來像您想要在根文件夾中查看該網站,並阻止任何其他人執行相同操作。在我看來,你想要做的是看看Apache手冊對身份驗證部分,授權 http://httpd.apache.org/docs/2.0/howto/auth.html
喜歡的東西在你的Apache配置的位置或目錄段以下,或在.htaccess文件應該工作。你可以把你想要顯示你的用戶的頁面放在特定位置
#The page you want to show denied users.
ErrorDocument 403 /path/to/403.html
#The page you want to show when pages aren't found (404)
ErrorDocument 404 /path/to/404.html
#For Password Protection
#Use the htpasswd utility to generate .htpasswd
AuthType Basic
AuthName "My Secret Stuff"
AuthUserFile /path/to/my/passwords/.htpasswd
Require valid-user
#For IP protection
Order allow,deny
Allow from 1.2.3.4 #Your IP Here
#If you want to use a combination of password and IP protection
#This directive works if they have a valid IP OR a valid user/pass
Satisfy any