0

Hi, friends. I'm creating an .htaccess file with rewrite rules. It's working fine in localhost, but on the live, server it's not working. My hosting uses a Window server.

I wrote this Rule in my .htaccess file:

RewriteEngine On
RewriteBase /project_name/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$

RewriteRule (.*) pages.php?page_slug=$1 [L]
4

1 回答 1

0

为了让wordpress在IIS服务器上运行,你需要在根目录下创建web.config,然后把代码放在下面,

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="wordpress" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
于 2014-11-19T05:41:26.203 回答