0

I need to change this .htaccess to web.config. Server is IIS and I want my PHP application to run on my server

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]
4

1 回答 1

0

如果您安装了 IIS,请打开管理器,单击任何站点,单击 URL 重写,在右侧面板上选择导入规则并粘贴您的 .htaccess 规则:

<rewrite>
  <rules>
    <rule name="Imported Rule 1">
       <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" />
    <add input="{R:1}" pattern="^(index.php|robots.txt)" ignoreCase="false" negate="true" />
  </conditions>
  <action type="Rewrite" url="index.php/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
  <match url="^(application|modules|plugins|system|themes)" ignoreCase="false" />
  <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
  </conditions>
  <action type="Rewrite" url="index.php/{R:1}" />
</rule>

于 2012-08-29T12:48:00.327 回答