SaidbakR
SaidbakR

Reputation: 13544

IIS and Yii2 pretty URL

What is the .htaccess equivalent for IIS to enable pretty URLs in Yii2 on IIS. Indeed, I don't know what could I do with web.conf to allow those URLs.

Upvotes: 5

Views: 3256

Answers (1)

avelasquez
avelasquez

Reputation: 116

try this on your web.config and save it on the root

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>

<directoryBrowse enabled="false" />

  <rewrite>
    <rules>
      <rule name="Hide Yii Index" 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="Rewrite" url="index.php" appendQueryString="true" />
      </rule> 
    </rules>
  </rewrite>
</system.webServer>
</configuration>

Upvotes: 10

Related Questions