Convert isapi rewrite rules to IIS 7 rewrite

最后都变了- 提交于 2019-12-11 21:46:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!