»ª·áÈí¼þ

»¥ÁªÍøÈí¼þ×ÊÔ´¹²Ïí

µ±Ç°Î»ÖãºÊ×Ò³ -> ×ÛºÏƵµÀ -> Õ¾³¤Ö®¼Ò

ISAPI_Rewrite ¸÷°æ±¾301תÏò´óÈ«£¨¸½ISAPI_RewriteÓï·¨¹æÔò£©

IIS ×öα¾²Ì¬²ÉÓõÄÊÇISAPI_Rewrite ²å¼þ£¬´ó¼ÒÖªµÀISAPI_Rewrite ²»½ö¿ÉÒÔʵÏÖurl ÖØд£¬»¹¿ÉÒÔÓÃÀ´ÉèÖÃ301תÏò£¨2.xÒÔÉϲÅÖ§³Ö£¬1.3°æ±¾½öÖ§³Ö302תÏò£©£¬ÏÂÃæ½éÉÜISAPI Rewrite×ö301Öض¨ÏòµÄ·½·¨£º

1. ½«²»´øwwwµÄ¶¥¼¶ÓòÃû301Öض¨Ïòµ½´øwwwµÄÓòÃû

# ISAPI_Rewrite 2.x °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond Host: ^downcc\.com$
RewriteRule (.*) http\://www\.downcc\.com$1 [I,RP]

# ISAPI_Rewrite 3.0 °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond %{HTTP:Host} ^downcc\.com$
RewriteRule (.*) http\://www\.downcc\.com$1 [NC,R=301]

2. ²»Í¬ÓòÃûÖ®¼äµÄ301תÏò

# ISAPI_Rewrite 2.x °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond %{HTTP:Host} ^downcc\.cn$
RewriteRule (.*) http\://www\.downcc\.com$1 [NC,R=301]

# ISAPI_Rewrite 3.0 °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond %{HTTP:Host} ^www\.downcc\.cn$
RewriteRule (.*) http\://www\.downcc\.com$1 [NC,R=301]

3. ½«Ò³Ãæ301Öض¨Ïòµ½ÁíÍâÒ»¸öÒ³Ãæ

# ISAPI_Rewrite 2.x °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule ^/oldpage.html$ http://downcc.com/dll.html[I,O,RP,L]

# ISAPI_Rewrite 3.0 °æ±¾
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule ^/oldpage.html$ http://downcc.com/dll.html[NC,L,R=301,O]

×¢Ò⣺ISAPI_Rewrite 1.3ÊÇÏÖÔÚ¹úÄÚÓ¦ÓõñȽ϶àµÄÒ»¸öÀÏ°æ±¾£¬Ëü¿ÉÓÃÓÚurl ÖØд£¬µ«²¢²»ÊʺÏÓÃÀ´ÊµÏÖÕæÕýµÄ301Öض¨Ïò¹¦ÄÜ¡£½¨ÒéÏÂÔØ×îеÄISAPI_Rewrite 3.0 °æ±¾¡£ISAPI_Rewrite 1.3 µÄÔÚIIS϶ÔÓòÃûÖض¨ÏòËäÈ»Äܹ»Ë³ÀûÌøת£¬µ«ÊÇ·µ»ØµÄÈÔÈ»ÊÇ302 HTTP header£¬¶ø²»ÊÇ301 ״̬Âë¡£¶øÇҸöδúÂëÓÃÓÚ301Öض¨Ïòºó£¬ÔÚ×ÓĿ¼ÖеÄÆäËûÒ³Ã涼»áÌøתµ½Ê×Ò³¡£

ÕâÑùÉèÖÃÒÔºó£¬ÄãµÄwindows iis Ò²ÄÜʵÏÖ301Öض¨ÏòÁË£¬²»¹ÜÊÇGoogle ºÍ°Ù¶ÈËÑË÷ÒýÇ涼²»»áÓÐÒòΪ´øÓÐwwwºÍ²»´øwww µÄÓòÃû¶ø²úÉúÖظ´Ò³ÃæÎÊÌâÁË¡£

301Öض¨ÏòÔÚÏß¼ì²â¹¤¾ß£ºhttp://www.ab173.com/zhanzhang/getheader.php

¸½£ºISAPI_RewriteÓï·¨¹æÔò

ISAPI_Rewrite ¹æÔò¶Ô´óСдÃô¸Ð£¬µ«¿ÉÒÔºöÂÔ´óСдÁË¡£
I (ignore case£©²»¹Ü´óСдǿÐÐÖ¸¶¨×Ö·ûÆ¥Åä¡£
Àý£ºRewriteRule /code/project/([0-9,a-z]*).html /soft.jsp\?softpy=$1 [I]

ÆäËûµÄ²ÎÊýÒ»ÀÀ
I (ignore case£©
²»¹Ü´óСдǿÐÐÖ¸¶¨×Ö·ûÆ¥Å䣬Õâ¸öFLAGÓ°ÏìRewriteRuleÖ¸ÁîºÍÏàÓ¦µÄRewriteCond Ö¸Áî¡£

F (Forbidden)
¶Ô¿Í»§¶Ë×ö·´Ó¦£¬Í£Ö¹REWRITING½ø³Ì²¢ÇÒ·¢ËÍ403´íÎó£¬×¢ÒâÔÚÕâÖÖÇé¿öÏÂFORMATSTRING ÊÇÎÞÓõIJ¢¿ÉÒÔÉèÖÃΪÈκηǿÕ×Ö·û´®¡£

L (last rule)
²»Ó¦ÓÃÈκÎÖØд¹æÔòÔÚ´ËÍ£Ö¹ÖØд½ø³Ì£¬Ê¹ÓÃÕâ¸öFLAGÒÔ×èÖ¹µ±Ç°±»ÖØдµÄURI±»ºóÃæµÄ¹æÔòÔÙ´ÎÖØд¡£

N (Next iteration)
Ç¿ÖÆREWRITINGENGINEµ÷Õû¹æÔòÄ¿±ê²¢ÇÒ´ÓÍ·ÖØÆô¹æÔò¼ì²é£¨ËùÓÐÐ޸Ľ«±£´æ£©£¬ÖØÆô´ÎÊýÓÉRepeatLimitÖ¸¶¨µÄÖµÏÞÖÆ£¬Èç¹ûÕâ¸öÊýÖµ³¬¹ýN FLAG½«±»ºöÂÔ¡£

NS (Next iteration of the same rule)
ÒÔN±ê¼Ç¹¤×÷²»´ÓÏàͬµÄ¹æÔòÖØÆô¹æÔò¹æÔò½ø³Ì£¨ÀýÈçÇ¿ÖÆÖظ´¹æÔòÓ¦Óã©£¬Í¨¹ýRepeatLimitÖ¸ÁîÖ¸¶¨Ò»¸ö·´¸´ÊµÐÐijһ¹æÔòµÄ×î´óÊýÄ¿¡£

P (force proxy)
Ç¿ÖÆÄ¿µÄURIÔÚÄÚ²¿Ç¿ÖÆΪ´úÀíÐèÇó²¢ÇÒÁ¢¼´Í¨¹ýISAPIÀ©Õ¹Ó¦¸¶´úÀíÐèÇ󣬱ØÐëÈ·ÈÏ´úÀí×Ö·û´®ÊÇÒ»¸öÓÐЧµÄURI°üÀ¨Ð­Òé Ö÷»úµÈµÈ·ñÔò´úÀí½«·µ»Ø´íÎó¡£

R (explicit redirect£©
Ç¿ÖÆ·þÎñÆ÷¶Ô¿Í»§¶Ë·¢³öÖض¨Ïòָʾ¼´Ê±Ó¦´ð£¬ÌṩĿµÄURIµÄеØÖ·£¬Öض¨Ïò¹æÔò¾­³£ÊÇ×îºó¹æÔò¡£

RP (permanent redirect)
¼¸ºõºÍ[R]±ê¼ÇÏàͬµ«ÊÇ·¢²¼301HTTP״̬¶ø²»ÊÇ302HTTP״̬´úÂë¡£

U (Unmangle Log)
µ±URIÊÇÔ´ÐèÇó¶ø²»ÊÇÖØдÐèÇóʱ¼ÇÔØURI¡£

O (nOrmalize)
ÔÚʵÐÐ֮ǰ±ê×¼»¯×Ö·û´®¡£±ê×¼»¯°üÀ¨URL-ENCODING£¬²»ºÏ·¨µÄ×Ö·ûµÄÔÙÒƶ¯µÈ£¬Õâ¸ö±ê¼Ç¶ÔÓÚURLSºÍURLS-ENDODEDÍ·ÊÇÓÐÓõġ£

CL (Case Lower)
Сд¡£

CU (Case Upper)
´óд¡£

RewriteHeader directive
Syntax: RewriteHeader HeaderName Pattern FormatString [Flags]
Õâ¸öÖ¸ÁîÊÇRewriteRuleµÄ¸ü¸ÅÀ¨»¯±äÖÖ£¬Ëü²»½öÖØдURLµÄ¿Í»§¶ËÐèÇ󲿷֣¬¶øÇÒÖØдHTTPÍ·£¬Õâ¸öÖ¸Áî²»½öÓÃÓÚÖØд¡£Éú³É£¬É¾³ýÈκÎHTTPÍ·£¬ÉõÖÁ¸Ä±ä¿Í»§¶ËÇëÇóµÄ·½·¨¡£

HeaderName
Ö¸¶¨½«±»ÖØдµÄ¿Í»§Í·£¬¿ÉÈ¡µÄÖµÓë RewriteCond Ö¸ÁîÖÐTestVerb²ÎÊýÏàͬ¡£

Pattern
ÏÞ¶¨¹æÔò±í´ïʽÒÔÆ¥ÅäRequest-URI¡£

FormatString
ÏÞ¶¨½«Éú³ÉеÄURIµÄFormatString ¡£
[Flags]
ÊÇÒ»¸öÏÂÁÐFLAGSµÄÃüÁî·Ö¸ôÁÐ±í¡£

I (ignore case£©
²»¹Ü´óСдǿÐÐÖ¸¶¨×Ö·ûÆ¥Å䣬Õâ¸öFLAGÓ°ÏìRewriteRuleÖ¸ÁîºÍÏàÓ¦µÄRewriteCond Ö¸Áî¡£
F (Forbidden)
¶Ô¿Í»§¶Ë×ö·´Ó¦£¬Í£Ö¹REWRITING½ø³Ì²¢ÇÒ·¢ËÍ403´íÎó£¬×¢ÒâÔÚÕâÖÖÇé¿öÏÂFORMATSTRING ÊÇÎÞÓõIJ¢¿ÉÒÔÉèÖÃΪÈκηǿÕ×Ö·û´®¡£

L (last rule)
²»Ó¦ÓÃÈκÎÖØд¹æÔòÔÚ´ËÍ£Ö¹ÖØд½ø³Ì£¬Ê¹ÓÃÕâ¸öFLAGÒÔ×èÖ¹µ±Ç°±»ÖØдµÄURI±»ºóÃæµÄ¹æÔòÔÙ´ÎÖØд¡£

N (Next iteration)
Ç¿ÖÆREWRITINGENGINEµ÷Õû¹æÔòÄ¿±ê²¢ÇÒ´ÓÍ·ÖØÆô¹æÔò¼ì²é£¨ËùÓÐÐ޸Ľ«±£´æ£©£¬ÖØÆô´ÎÊýÓÉRepeatLimitÖ¸¶¨µÄÖµÏÞÖÆ£¬Èç¹ûÕâ¸öÊýÖµ³¬¹ýN FLAG½«±»ºöÂÔ¡£

NS (Next iteration of the same rule)
ÒÔN±ê¼Ç¹¤×÷²»´ÓÏàͬµÄ¹æÔòÖØÆô¹æÔò¹æÔò½ø³Ì£¨ÀýÈçÇ¿ÖÆÖظ´¹æÔòÓ¦Óã©£¬Í¨¹ýRepeatLimitÖ¸ÁîÖ¸¶¨Ò»¸ö·´¸´ÊµÐÐijһ¹æÔòµÄ×î´óÊýÄ¿¡£

R (explicit redirect£©
Ç¿ÖÆ·þÎñÆ÷¶Ô¿Í»§¶Ë·¢³öÖض¨Ïòָʾ¼´Ê±Ó¦´ð£¬ÌṩĿµÄURIµÄеØÖ·£¬Öض¨Ïò¹æÔò¾­³£ÊÇ×îºó¹æÔò¡£

RP (permanent redirect)
¼¸ºõºÍ[R]±ê¼ÇÏàͬµ«ÊÇ·¢²¼301HTTP״̬¶ø²»ÊÇ302HTTP״̬´úÂë¡£

U (Unmangle Log)
µ±URIÊÇÔ´ÐèÇó¶ø²»ÊÇÖØдÐèÇóʱ¼ÇÔØURI¡£

O (nOrmalize)
ÔÚʵÐÐ֮ǰ±ê×¼»¯×Ö·û´®¡£±ê×¼»¯°üÀ¨URL-ENCODING£¬²»ºÏ·¨µÄ×Ö·ûµÄÔÙÒƶ¯µÈ£¬Õâ¸ö±ê¼Ç¶ÔÓÚURLSºÍURLS-ENDODEDÍ·ÊÇÓÐÓõġ£

CL (Case Lower)
Сд¡£
CU (Case Upper)
´óд¡£



ÉÏһƪ£ºIIS7 ¶àÓòÃû°ó¶¨Í¬Ò»ÎïÀíĿ¼²»Í¬..
ÏÂһƪ£ºCSSÏÞÖÆ×ÖÊý,³¬³ö²¿·ÝÏÔʾµãµãµã

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

ËÑË÷
×îÐÂÎÄÕÂ
ͼƬÖ÷Ìâ
ÈÈÃÅÎÄÕÂ
ÍƼöÎÄÕÂ
Ïà¹ØÎÄÕÂ

    Ê× Ò³   |   °æȨÉùÃ÷   |   ¹ØÓÚÎÒÃÇ   |   ¹ã¸æ·þÎñ   |   ÁªÏµÎÒÃÇ   |   ÊÖ»ú°æ    |   ÍøÕ¾µØͼ
    Copyright@zhuchunyu.com all rights reserved
    Powered by zhuchunyu.com 2018-2025 zhuchunyu.com ÍîICP±¸05011767ºÅ-23