1

我想通过 web.config 将动态 URL 重定向到静态 URL。但是现在我没有通过我上传的 web.config 文件获得任何重定向。动态 URL 如下: - http://www.greatmathworksheets.com/?page=grade-worksheets-list&levelid=11 等,如 levelid=12 等。要重定向的静态 URL 如下 - http:// /www.greatmathworksheets.com/grade-based-curriculums-11 等等,比如 levelid=12

请让我知道我应该怎么做才能重定向 URL。请帮我。

web.config 文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Rule 1">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^www\.greatmathworksheets\.com$" negate="true" />
                </conditions>
                <action type="Redirect" url="http://www.greatmathworksheets.com/{R:1}" />
            </rule>
            <rule name="Rule 2" stopProcessing="true">
                <match url="^index\.php$" ignoreCase="false" />
                <action type="Redirect" url="http://www.greatmathworksheets.com/" redirectType="Permanent" />
            </rule>
            <rule name="Rule 3" stopProcessing="true">
                <match url="^([a-z]+)$" ignoreCase="false" />
                <action type="Rewrite" url="?page={R:1}" appendQueryString="false" />
            </rule>
            <rule name="Rule 4" stopProcessing="true">
                <match url="^contact-us$" ignoreCase="false" />
                <action type="Rewrite" url="?page=contact-us" appendQueryString="false" />
            </rule> 
    <rule name="Rule 7">
            <match url="^grade-based-curriculum$" ignoreCase="false" />
            <action type="Rewrite" url="?page=grade_level_curriculum" appendQueryString="false" />
            </rule>
            <rule name="Rule 8">
                <match url="^activity-based-curriculum$" ignoreCase="false" />
                <action type="Rewrite" url="?page=skill_level_curriculum" appendQueryString="false" />
            </rule>        
    <rule name="Rule 13">
                <match url="activity-based-curriculums-(.*)" ignoreCase="false" />
                <action type="Rewrite" url="?page=worksheets-list&amp;levelid={R:1}" appendQueryString="false" />
            </rule>
            <rule name="Rule 14">
                <match url="grade-based-curriculums-(.*)" ignoreCase="false" />
                <action type="Rewrite" url="?page=grade-worksheets-list&amp;levelid={R:1}" appendQueryString="false" />
            </rule>

 <rule name="Rule 15" stopProcessing="true">
                  <match url="(.*)/$" ignoreCase="false" />
                 <conditions logicalGrouping="MatchAll">
  <add input="{QUERY_STRING}" pattern="page=inquiry" />
                       </conditions>
                <action type="Redirect"        url="http://www.greatmathworksheets.com/inquiry" redirectType="Permanent" />
            </rule> 
        </rules>
    </rewrite>
</system.webServer>
</configuration>

谢谢,

尼丁

4

0 回答 0