绀轰緥1锛
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="瑙勫垯 1" stopProcessing="true"> <match url="^includes/(.*)" /> <action type="Rewrite" url="includes\/{R:1}" /> </rule> <rule name="瑙勫垯 2" stopProcessing="true"> <match url="^(blog)/includes/(.*)" /> <action type="Rewrite" url="{R:1}/includes\/{R:2}" /> </rule> <rule name="瑙勫垯 3" stopProcessing="true"> <match url="^(blog)/(.*).html(.*)" /> <action type="Rewrite" url="{R:1}/index.php\/{R:2}.html{R:3}" /> </rule> <rule name="瑙勫垯 4" stopProcessing="true"> <match url="^(.*).html(.*)" /> <action type="Rewrite" url="index.php\/{R:1}.html{R:2}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
绀轰緥2锛
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Imported Rule 1"> <match url="list-([0-9]+)\.html" ignoreCase="false"/> <action type="Rewrite" url="plus/list.php?tid={R:1}" appendQueryString="false"/> </rule> <rule name="Imported Rule 2"> <match url="list-([0-9]+)-([0-9]+)-([0-9]+)\.html" ignoreCase="false"/> <action type="Rewrite" url="plus/list.php?tid={R:1}&TotalResult={R:2}&PageNo={R:3}" appendQueryString="false"/> </rule> <rule name="Imported Rule 3"> <match url="view-([0-9]+)-([0-9]+)\.html" ignoreCase="false"/> <action type="Rewrite" url="plus/view.php?arcID={R:1}&pageno={R:2}" appendQueryString="false"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
绀轰緥3锛
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="portal_topic"> <match url="^(.*/)*topic-(.+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/portal.php?mod=topic&topic={R:2}&{R:3}"/> </rule> <rule name="portal_article"> <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/portal.php?mod=view&aid={R:2}&page={R:3}&{R:4}"/> </rule> <rule name="forum_forumdisplay"> <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/forum.php?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}"/> </rule> <rule name="forum_viewthread"> <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/forum.php?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}"/> </rule> <rule name="group_group"> <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/forum.php?mod=group&fid={R:2}&page={R:3}&{R:4}"/> </rule> <rule name="home_space"> <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/home.php?mod=space&{R:2}={R:3}&{R:4}"/> </rule> <rule name="home_blog"> <match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/home.php?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}"/> </rule> <rule name="forum_archiver"> <match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/index.php?action={R:2}&value={R:3}&{R:4}"/> </rule> <rule name="plugin"> <match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$"/> <action type="Rewrite" url="{R:1}/plugin.php?id={R:2}:{R:3}&{R:4}"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
鎻愮ず1銆<rule>鑺傜偣鐨刵ame涓嶈兘閲嶅銆
鎻愮ず2銆<match>閲岀殑url鏄竴涓鍒欒〃杈惧紡锛屽疄渚嬮噷^(.*)t/([0-9,a-z]*)鏄竴涓父鐢ㄧ殑鍙ュ紡銆
^鍖归厤鍩熷悕寮澶达紝濡傦細http://u.odweb.cn/锛屾敞鎰忓煙鍚嶅悗闈㈡湁涓枩鏉/銆
(.*)鍖归厤浠讳綍瀛楃銆
([0-9,a-z]*)鍖归厤浠讳綍鏁板瓧鍜屽瓧姣嶃
鍥犳锛宆(.*)t/([0-9,a-z]*) 鍙互鍖归厤濡備笅鐨勮闂綉鍧锛堝亣濡傜綉绔欏煙鍚嶆槸u.odweb.cn锛夛細
鎻愮ず3銆<action type="Rewrite" ...>琛ㄧず鎵ц鐨勭被鍨嬫槸閲嶅啓锛岄噷闈㈢殑url鏄疄闄呯綉鍧锛寋R:1}/list.asp?id={R:2} 鐨勮В閲婂涓嬶細
{R:1}瀵瑰簲<match>閲岀殑url鐨勭涓涓嫭鍙峰唴瀹癸紝{R:2}瀵瑰簲<match>閲岀殑url鐨勭浜屼釜鎷彿鍐呭锛屽鏋滄湁{R:3}銆亄R:4}锛屽姝ょ被鎺ㄣ
鎵浠ワ紝濡傛灉鍋囧鐢ㄦ埛璁块棶鐨勭綉鍧鏄
http://u.odweb.cn/t/123
http://u.odweb.cn/news/t/a1
閭d箞锛屽叾瀵瑰簲鐨勫疄闄呯綉鍧鏄
http://u.odweb.cn/news_show.asp?id=123
http://u.odweb.cn/news/news_show.asp?id=a1
鎻愮ず4銆佹寜鐓т笂闈㈢殑瑙i噴锛屼綘搴旇宸笉澶氳兘璇绘噦瀹炰緥鐨剅ule2閲嶅啓瑙勫垯浜嗐
$锛岃繖鏄釜缁撴潫绗︼紝琛ㄧず鍖归厤鐨剈rl鍒版缁撴潫锛屽悗闈㈡病鏈夊叾浠栧瓧绗︿簡銆
([0-9]+) 琛ㄧず鍖归厤浠讳綍鏁板瓧銆
\.html 琛ㄧず鍖归厤 .html銆
\?琛ㄧず鍖归厤涓涓棶鍙?銆
鐗瑰埆瑕佹敞鎰忥紝鍙嶆枩鏉燶鏄浆涔夌锛屽洜涓烘鍒欒〃杈惧紡閲岋紝涓鐐.鏄〃绀哄尮閰嶄换浣曞瓧绗︾殑鎰忔濓紝鎵浠ヨ鍔犱笂鍙嶆枩鏉犲鍏惰浆涔夛紝杩欐牱鎵嶈〃绀哄尮閰嶇殑鏄竴涓偣.銆
鍚屾牱鍦帮紝闂彿?涔熸槸涓涓厓绗﹀彿锛屽畠琛ㄧず鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忛浂娆℃垨涓娆★紝鍥犳锛屼篃闇瑕佸湪鍏跺墠闈㈠姞涓婅浆涔夌\锛岃繖鎵嶈〃绀哄尮閰嶇殑鏄竴涓棶鍙?銆
鎻愮ず5銆佸叾浠
ignoreCase="false" 琛ㄧず涓嶈兘蹇界暐澶у皬鍐欙紝濡傛灉璇ュ艰涓簍rue锛屽垯琛ㄧず蹇界暐澶у皬鍐欍
appendQueryString="false" 琛ㄧず涓嶄娇鐢╱rl鍙傛暟銆
浠ヤ笂灏辨槸浼潤鎬亀eb.config URL閲嶅啓鍙傛暟璇﹁В鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒