兼容IIS7以上版本的原生rewrite支持。
By
lincanbin
at 2015-05-17 • 1人收藏 • 2079人看过
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Carbon Forum Rule 1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^94cb.com$" /> </conditions> <action type="Redirect" url="http://www.94cb.com/{R:1}" redirectType="Permanent" /> </rule> <rule name="Carbon Forum Rule 2"> <match url=".*" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_METHOD}" pattern="^TRACE" ignoreCase="false" /> </conditions> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Carbon Forum Rule 3" stopProcessing="true"> <match url="^includes" ignoreCase="false" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Carbon Forum Rule 4" stopProcessing="true"> <match url="^styles/default/template" ignoreCase="false" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Carbon Forum Rule 5" stopProcessing="true"> <match url="^styles/mobile/template" ignoreCase="false" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Carbon Forum Rule 6" stopProcessing="true"> <match url="^styles/api/template" ignoreCase="false" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Carbon Forum Rule 7" stopProcessing="true"> <match url="^dashboard$" ignoreCase="false" /> <action type="Rewrite" url="dashboard.php" /> </rule> <rule name="Carbon Forum Rule 8" stopProcessing="true"> <match url="^favorites(/page/([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="favorites.php?page={R:2}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 9" stopProcessing="true"> <match url="^json/(get_tags|tag_autocomplete|check_username)$" ignoreCase="false" /> <action type="Rewrite" url="json.php?action={R:1}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 10" stopProcessing="true"> <match url="^login$" ignoreCase="false" /> <action type="Rewrite" url="login.php" /> </rule> <rule name="Carbon Forum Rule 11" stopProcessing="true"> <match url="^manage$" ignoreCase="false" /> <action type="Rewrite" url="manage.php" /> </rule> <rule name="Carbon Forum Rule 12" stopProcessing="true"> <match url="^new$" ignoreCase="false" /> <action type="Rewrite" url="new.php" /> </rule> <rule name="Carbon Forum Rule 13" stopProcessing="true"> <match url="^notifications$" ignoreCase="false" /> <action type="Rewrite" url="notifications.php" /> </rule> <rule name="Carbon Forum Rule 14" stopProcessing="true"> <match url="^page/([0-9]+)$" ignoreCase="false" /> <action type="Rewrite" url="index.php?page={R:1}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 15" stopProcessing="true"> <match url="^register$" ignoreCase="false" /> <action type="Rewrite" url="register.php" /> </rule> <rule name="Carbon Forum Rule 16" stopProcessing="true"> <match url="^reply$" ignoreCase="false" /> <action type="Rewrite" url="reply.php" /> </rule> <rule name="Carbon Forum Rule 17" stopProcessing="true"> <match url="^robots.txt$" ignoreCase="false" /> <action type="Rewrite" url="robots.php" /> </rule> <rule name="Carbon Forum Rule 18" stopProcessing="true"> <match url="^settings$" ignoreCase="false" /> <action type="Rewrite" url="settings.php" /> </rule> <rule name="Carbon Forum Rule 19" stopProcessing="true"> <match url="^search.xml$" ignoreCase="false" /> <action type="Rewrite" url="open_search.php" /> </rule> <rule name="Carbon Forum Rule 20" stopProcessing="true"> <match url="^search/(.*?)(/page/([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="search.php?keyword={R:1}&page={R:3}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 21" stopProcessing="true"> <match url="^sitemap-(topics|pages|tags|users|index)(-([0-9]+))?.xml$" ignoreCase="false" /> <action type="Rewrite" url="sitemap.php?action={R:1}&page={R:3}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 22" stopProcessing="true"> <match url="^t/([0-9]+)(-([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="topic.php?id={R:1}&page={R:3}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 23" stopProcessing="true"> <match url="^tag/(.*?)(/page/([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="tag.php?name={R:1}&page={R:3}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 24" stopProcessing="true"> <match url="^tags/following(/page/([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="favorite_tags.php?page={R:2}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 25" stopProcessing="true"> <match url="^u/(.*?)$" ignoreCase="false" /> <action type="Rewrite" url="user.php?username={R:1}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 26" stopProcessing="true"> <match url="^users/following(/page/([0-9]*))?$" ignoreCase="false" /> <action type="Rewrite" url="favorite_users.php?page={R:2}" appendQueryString="false" /> </rule> <rule name="Carbon Forum Rule 27" stopProcessing="true"> <match url="^upload_controller$" ignoreCase="false" /> <action type="Rewrite" url="upload_controller.php" /> </rule> <rule name="Carbon Forum Rule 28" stopProcessing="true"> <match url="^view-(desktop|mobile)$" ignoreCase="false" /> <action type="Rewrite" url="view.php?view={R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
https://github.com/lincanbin/Carbon-Forum/blob/master/web.config
登录后方可回帖