读:APACHE经典实例
Posted on | 三月 12, 2010 | No Comments
1.RewriteCond %{REQUEST_URI} “string1″
RewriteRule “(.*)string1(.*)” “$1string$2″[N,PT]
N标记告诉APACHE要执行重写规则,之道REWRITECOND失效为止
PT告诉mod_rewrite把重写的URL传给APACHE
2.替现有网页创建新LINK
Alias /newurl /www/htdocs/oldurl
3.拒绝访问典型
RewriteEngine On
ReWriteCond %{HTTP_REFERER} !=”"
ReWriteCond %{HTTP_REFERER} “!^http://www.example.com/.*$”[NC]
ReWriteCond %{REQUEST_URI} “\.(JPG|GIF|PNG$)”
ReWriteRule .*-[F]
4.[QSA.PT]
QSA表示加入查询字符串
5.<FilesMatch “\.(jpg|png)$”>
….
6.ErrorDocument 404 /index.html
DirectoryIndex index.html /path/nofound.html
7..ico图标
AddType image/x-icon .ico
<Files favcion.ico>
ErrorDocument 404 /ICON/favicon.ico
</Files>
8.CGI脚本测试
#! /user/bin/perll
print “Content-type:text/plain\r\n\r\n”;
print “It is wording”;
9.开启SSI解析功能之后
<–#include virtual=”/cgi-bin/hello.cgi”>
10.Redirect /https://example.com
直接SSL跳转
果然APACHE很强大
http://htttpd.apache.org/docs/mud/mud_rewrite.html等有更详细说明
相关文章:
评论|Comments
留言|Leave a Reply
![如果您自认为是一位忠实的Silverlight-Fans,那么请将此标志放到您的博客中成为一名真正的[银光使者]](http://images.cnblogs.com/cnblogs_com/alamiye010/Silverlighter1.jpg)