blc*_*llo 1 php apache .htaccess
将所有流量发送到您网站的最佳方式是404页?我目前正在该网站上工作,并希望所有请求只需404.我已经尝试过使用htaccess文件,但是在获得这样的工作方面并不太成功.此外,我想流量到特定的文件夹仍然通过.
正如您的问题所述,最简单的方法是将所有内容移动到该文件夹中.
但是,在行之间读取它听起来像是要在根文件夹中查看该站点,并阻止其他任何人执行相同操作.在我看来,你想要做的是查看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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
172 次 |
| 最近记录: |