简体   繁体   中英

Rewrite rule is not working proper in IIS for phpfox

** I change my rewrite rule to change my website link from www.mydomain.com/index.php?do=/blog to www.mydomain.com/blog after this when i tried the below code, it won't let me change any page, like if i want to go for www.mydomain.com/blog, i just got stucked at www.mydomain.com, means redirect to my same root page,

what changes should i made for this please help. i am a newbei

my code is**

`<rule name="Redirect index.php" stopProcessing="true">
    <match url="index\.php/(.*)" />
    <action type="Redirect" url="{R:1}" appendQueryString="false" />
  </rule>
  <rule name="Rewrite index.php">
    <match url="(.*)" />
    <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php/{R:1}" />
  </rule>
</rules>`

Based on this forum post about .htaccess rewrites, you need to rewrite to:

index.php?do=/{R:1}

You are missing the ?do= part in the middle.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
          <rules>
            <rule name="Imported Rule 1">
              <match url="^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)_([0-9]*?)\.(.*)$" ignoreCase="false" />
              <action type="Rewrite" url="file/pic/photo/{R:1}/{R:2}/{R:3}_{R:5}.{R:6}" />
            </rule>
            <rule name="Imported Rule 2">
              <match url="^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)\.(.*)$" ignoreCase="false" />
              <action type="Rewrite" url="file/pic/photo/{R:1}/{R:2}/{R:3}.{R:5}" />
            </rule>
            <rule name="Imported Rule 3">
              <match url="^(.*)$" ignoreCase="false" />
              <conditions>
                <add input="{HTTP_HOST}" pattern="^www\." ignoreCase="false" negate="true" />
              </conditions>
              <action type="Redirect" redirectType="Found" url="http://www.%" />
            </rule>
            <rule name="Imported Rule 4" stopProcessing="true">
              <match url="[^/]$" ignoreCase="false" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
              <action type="Redirect" redirectType="Permanent" url="{URL}/" />
            </rule>
            <rule name="Imported Rule 5">
              <match url="^(.*)" ignoreCase="false" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php?do=/{R:1}" appendQueryString="false" />
            </rule>
            <rule name="Imported Rule 6">
              <match url="^file/pic/photo/(.*)\.(.*)$" ignoreCase="false" />
              <action type="Rewrite" url="static/image.php?file={R:1}&amp;ext={R:2}" appendQueryString="false" />
            </rule>
          </rules>
        </rewrite>
    </system.webServer>
</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM