- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
htaccess规则详细介绍
htaccess可以做大量范围的事情,包括:文件夹密码保护、用户自动重新指向、自定义错误页面、变更你的文件扩展名、屏蔽特定的用户IP地址、只允许特定的IP地址、停止目录表以及使用其他文件作为index文件,等等1. Introduction 介绍文件名 .htaccess 属性 644 (RW-R–R–)htaccess会影响它所在目录下的所有子目录注意大多数内容都要求保持在一行之内,不要换行,否则会引起错误2. Error Documents 错误文档Official document: ErrorDocument DirectiveErrorDocument code document例子ErrorDocument 400 /errors/badrequest.htmlErrorDocument 404 http://yoursite/errors/notfound.htmlErrorDocument 401 “Authorization Required”more.. less.. (注意之后内容如果出现的双引号需要转义为 \”)常见HTTP状态码Successful Client Requests200 OK201 Created202 Accepted203 Non-Authorative Information204 No Content205 Reset Content206 Partial ContentClient Request Redirected300 Multiple Choices301 Moved Permanently302 Moved Temporarily303 See Other304 Not Modified305 Use ProxyClient Request Errors400 Bad Request401 Authorization Required402 Payment Required (not used yet)403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable (encoding)407 Proxy Authentication Required408 Request Timed Out409 Conflicting Request410 Gone411 Content Length Required412 Precondition Failed413 Request Entity Too Long414 Request URI Too Long415 Unsupported Media TypeServer Errors500 Internal Server Error501 Not Implemented502 Bad Gateway503 Service Unavailable504 Gateway Timeout505 HTTP Version Not Supported3. Password Protection 密码保护Official document: Authentication, Authorization and Access Control假设密码文件为.htpasswdAuthUserFile /usr/local/safedir/.htpasswd (这里必须使用全路径名)AuthName EnterPasswordAuthType Basic两种常见验证方式:Require user windix(仅允许用户windix登陆)Require valid-user(所有合法用户都可登陆)Tip: 如何生成密码文件使用htpasswd命令(apache自带)第一次生成需要创建密码文件htpasswd -c .htpasswd user1之后增加新用户htpasswd .htpasswd user24. Enabling SSI Via htaccess 通过htaccess允许SSI(Server Side Including)功能AddType text/html .shtmlAddHandler server-parsed .shtmlOptions Indexes FollowSymLinks IncludesDirectoryIndex index.shtml index.html5. Blocking users by IP 根据IP阻止用户访问order allow,denydeny fro
文档评论(0)