网站运营
位置:首页>> 网站运营>> Apache 中 .htaccess 文件设置技巧16则(3)

Apache 中 .htaccess 文件设置技巧16则(3)

 来源:asp之家 发布时间:2010-03-08 13:42:00 

标签:Apache,.htaccess,站长之家

11. 阻止存取.htaccess 文件

 

# secure htaccess file

order allow,deny
deny from all

 

12. 保护服务器上的文件被存取

 

# prevent access of a certain fileorder allow,deny
deny from all

 

13. 阻止目录浏览

 

# disable directory browsing
Options All -Indexes

 

14. 设置默认主页

 

# serve alternate default index page
DirectoryIndex about.html

 

15. 口令认证– 你可以创建一个文件用于认证。下面是一个示例:

 

# to protect a file

AuthType Basic
AuthName “Prompt”
AuthUserFile /home/path/.htpasswd
Require valid-user

# password-protect a directory
resides
AuthType basic
AuthName “This directory is protected”
AuthUserFile /home/path/.htpasswd
AuthGroupFile /dev/null
Require valid-user

 

16. 把老的域名转像新的域名

 

# redirect from old domain to new domain
RewriteEngine On
RewriteRule ^(.*)$http://www.yourdomain.com/$1[R=301,L]

 

0
投稿

猜你喜欢

手机版 网站运营 asp之家 www.aspxhome.com