将.htaccess url重写为web.config

时间:2016-08-28 10:41:54

标签: web-config

我的.htaccess文件包含代码:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domainname\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]
RewriteRule ^(.+)\.html$ page.php?title=$1 [PT,L,QSA]

我以下列方式将该代码转换为web.config文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<sectionGroup name="system.webServer">
    <sectionGroup name="rewrite">
        <section name="rewriteMaps" overrideModeDefault="Allow" />
        <section name="rules" overrideModeDefault="Allow" />
    </sectionGroup>
</sectionGroup>
</configSections>

 <system.webServer>
    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true"/>

<rule name="rule 1q" stopProcessing="true">
<match url="^(.*)$"  />
<action type="Rewrite" url="/http://www.domainname.com/{R:1}"  />
</rule>
<rule name="rule 2q" stopProcessing="true">
<match url="^(.+)\.html$"  />
<action type="Rewrite" url="/page.php?title={R:1}"  appendQueryString="true"     />
</rule>

 </system.webServer>
</configuration>        

但即使这样,我也会得到500 error

如果有人可以提供帮助,我将感激不尽。

由于

0 个答案:

没有答案