问题
I am using helicon isapi rewrite with vbSEO on vBulletin forums. I don't see any need to be using a separate isapi rewrite tool if I'm using IIS 7. Rewrite rules and regex are not my strength. If anyone can help me convert the info below into an IIS 7 url rewrite configuration I would greatly appreciate it.
Thank you in advance.
RewriteCond %{HTTP_HOST} .*vbdotnetforums.com
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{HTTP_HOST} .*vbdotnetforums.com
RewriteCond %{REQUEST_URI} !/(admincp/|modcp/|cron)
RewriteRule ^/((archive/)?(.*\.php(/.*)?))$ /vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{HTTP_HOST} .*vbdotnetforums.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^/(admincp|modcp|clientscript|cpstyles|images|search\.php|api\.php)/
RewriteRule ^/(.+)$ /vbseo.php?vbseourl=$1 [L,QSA]
回答1:
How about this:
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$" />
<conditions>
<add input="{HTTP_HOST}" pattern=".*vbdotnetforums.com" />
</conditions>
<action type="Rewrite" url="vbseo_sitemap/vbseo_getsitemap.php?sitemap={R:1}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^((archive/)?(.*\.php(/.*)?))$" />
<conditions>
<add input="{HTTP_HOST}" pattern=".*vbdotnetforums.com" />
<add input="{URL}" pattern="/(admincp/|modcp/|cron)" negate="true" />
</conditions>
<action type="Rewrite" url="/vbseo.php?vbseourl={R:1}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^(.+)$" />
<conditions>
<add input="{HTTP_HOST}" pattern=".*vbdotnetforums.com" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="^/(admincp|modcp|clientscript|cpstyles|images|search\.php|api\.php)/" negate="true" />
</conditions>
<action type="Rewrite" url="/vbseo.php?vbseourl={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
Did you know that you can import ISAPI_Rewrite rules (which are based on mod_rewrite
) using IIS7's management console?
来源:https://stackoverflow.com/questions/20038145/convert-isapi-rewrite-rules-to-iis-7-rewrite