从 2003年底,wordpress流行到全球大部分地区,偶就开始关注并使用这个程序了,它是一个优秀的程序框架,里面有各种官方及民间作者的插件,配置,教程,解释,图文以及相关的文章,所以偶很喜欢它并在自己的部分站点一直使用到今天。相信各位站长也对这个程序相当的熟悉,这里就不再详细说明它,它有多少功能,或多么的强大和有哪些好处,对于网站程序。
第一次接触这个程序是在 2004年底的时候,大概偶还不怎么会电脑操作,也就是在广州那边学电脑时期。第一眼就发现这个程序很特别,简单的界面,看上去很普通,但却又不失功能,登录后台之后发现和国内的那些新闻系统,cms系统完全是两个不同的界面,从那时起便下定决心以后有机会就把新浪博客的文章转到这个系统里面,可惜当时没有钱去开支 php+mysql这类价格昂贵的空间,这在当时就算是 500m空间 + 50m数据库,也是上千的费用,好点的更是 5000以上了。所以想都不敢去想更别说去实现和使用这个程序。
多的闲话不再闸述,这里只列出 iis8.5的 wordpress相关功能规则。
// iis8.5 web.config wordpress rule 默认文档/网站入口索引文件(index)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!-- BEGIN Directory browse --> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="default.htm" /> <add value="default.html" /> <add value="default.asp" /> <add value="default.aspx" /> <add value="index.pl" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> <add value="index.shtm" /> <add value="index.shtml" /> <add value="index.asp" /> <add value="index.aspx" /> </files> </defaultDocument> <!-- END Directory browse --> |
//wordpress相关规则及伪静态和过滤
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <!-- BEGIN wordpress --> <!-- BEGIN Imported --> <rule name="Imported Rule 1"> <match url="logout/" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{QUERY_STRING}" pattern="^action=logout$" /> </conditions> <action type="Rewrite" url="[NC]" /> </rule> <rule name="Imported Rule 2" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="Imported Rule 3" stopProcessing="true"> <match url="." ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/index.php" /> </rule> <!-- END Imported --> <!-- BEGIN wordpress rule --> <rule name="wordpress rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="wordpress rule 2" stopProcessing="true"> <match url="^files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> </rule> <rule name="wordpress rule 3" stopProcessing="true"> <match url="^wp-admin$" ignoreCase="false" /> <action type="Redirect" url="wp-admin/" redirectType="Permanent" /> </rule> <!-- wordpress rule 4,Unable to jump HTTP to HTTPS after opening. --> <rule name="wordpress rule 4" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="wordpress rule 5" stopProcessing="true"> <match url="^(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:1}" /> </rule> <rule name="wordpress rule 6" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule> <rule name="wordpress rule 7" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> <rule name="wordpress main rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> <!-- END wordpress rule --> <!-- END wordpress --> |
// wp super cache规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | <!-- BEGIN wp_super_cache --> <rule name="WP_Super_Cache_HTTPS_mobile_gzip" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author|wordpress_logged_in|wp-postpass)_.*$" negate="true" /> <add input="{HTTP_X_WAP_PROFILE}" pattern="^[a-z0-9\"]+" /> <add input="{HTTP_PROFILE}" pattern="^[a-z0-9\"]+" /> <add input="{HTTP_USER_AGENT}" pattern="^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" /> <add input="{HTTPS}" pattern="on" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https-mobile.html.gz" matchType="IsFile" /> </conditions> <serverVariables> <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" /> <set name="HTTP_ACCEPT_ENCODING" value=""/> </serverVariables> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https-mobile.html.gz" /> </rule> <!-- SSL in WordPress: How To Move Your WordPress Site to HTTPS? The Definitive Guide --> <rule name="WP_Super_Cache_HTTPS_mobile" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTP_X_WAP_PROFILE}" pattern="^[a-z0-9\"]+" /> <add input="{HTTP_PROFILE}" pattern="^[a-z0-9\"]+" /> <add input="{HTTP_USER_AGENT}" pattern="^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" negate="true" /> <add input="{HTTPS}" pattern="on" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https-mobile.html" matchType="IsFile" /> </conditions> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https-mobile.html" /> </rule> <rule name="WP_Super_Cache_HTTPS_gzip" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" /> <add input="{HTTPS}" pattern="on" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https.html.gz" matchType="IsFile" /> </conditions> <serverVariables> <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" /> <set name="HTTP_ACCEPT_ENCODING" value=""/> </serverVariables> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https.html.gz" /> </rule> <rule name="WP_Super_Cache_HTTPS" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" negate="true" /> <add input="{HTTPS}" pattern="on" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https.html" matchType="IsFile" /> </conditions> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-https.html" /> </rule> <!-- This rule must rewrite plug-ins to take effect,because "/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index.html" overlay index page,please modify "index.html" to "index-http.html". --> <!-- <rule name="WP_Super_Cache_HTTP_gzip" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" /> <add input="{HTTPS}" pattern="on" negate="true" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-http.html.gz" matchType="IsFile" /> </conditions> <serverVariables> <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" /> <set name="HTTP_ACCEPT_ENCODING" value=""/> </serverVariables> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-http.html.gz" /> </rule> <rule name="WP_Super_Cache_HTTP" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" negate="true" /> <add input="{HTTPS}" pattern="on" negate="true" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-http.html" matchType="IsFile" /> </conditions> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index-http.html" /> </rule> --> <!-- rewrite everything else to WP-Super-Cache's index.html cache file,Unable to jump HTTP to HTTPS after opening,because "/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index.html" overlay index page,please modify "index.html" to "index-http.html". --> <rule name="WP_Super_Cache_HTTP" stopProcessing="true"> <match url="^(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^(.*)$" /> <add input="{URL}" pattern="^/wp-admin/.*" negate="true" /> <add input="{REQUEST_METHOD}" pattern="POST" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" negate="true" /> <add input="{HTTPS}" pattern="on" negate="true" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index.html" matchType="IsFile" /> </conditions> <action type="Rewrite" url="/wp-content/cache/supercache/{SERVER_NAME}/{R:1}/index.html" /> </rule> <!-- old wp wuper cache rule. --> <!-- <rule name="wp super cache" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /> <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" /> <add input="{QUERY_STRING}" pattern=".*attachment_id=.*" negate="true" /> <add input="{HTTP_COOKIE}" pattern="^.*(comment_author_|wordpress|wp-postpass_).*$" negate="true" /> <add input="{HTTP_USER_AGENT}" pattern="^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).*" negate="true" /> <add input="{DOCUMENT_ROOT}/wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html" matchType="IsFile" /> </conditions> <action type="Rewrite" url="wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html" /> </rule> --> <!-- END wp_super_cache --> |
这个也不能专门解释,因为里面英文注释已经写得非常清晰。如果你也使用和爱好这个程序,也可以研究下偶写的规则。至少它在 iis8.5下面是正常工作的。或许布署时会遇到一些组件报错及权限问题,但参考微软和mozilla社区帮助文档,多少还是能够解决那些基本问题的。
wordpress的很多插件是不支持 windows iis系列的,通常只会支持 apache mod_rewrite 和 nginx conf这类服务器软件版本,但其实也是有解决方法的,只要具体看官方及插件作者的文档,你就会发现它们其实是可以支持 iis8.5的。当然解决这些问题需要一定的时间及对网站的熟悉程度。