CQ-CSER

web设计开发爱好者

读: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等有更详细说明

相关文章:

  1. .htaccess技巧
  2. 修改.htaccess实现301重定向[转]
  3. WordPress 永久链接以及在各种平台上的实现方法

评论|Comments

留言|Leave a Reply





  • 微波:

    既然要赌,就要赌到底,玩命才会WIN
  • SUNSHINE

  • About

    本博客采用创作共用版权协议,要求署名、非商业用途和保持一致. 转载本博客内容也遵循“署名-非商业用途-保持一致”的创作共用协议.

    订阅

    Search

    Admin