My way to hide index.php on IIS 7

Even if there are tutorials and topics about hiding index.php, I failed to achieve that by following those steps.

And most of the tutorials are all based on Apache not IIS.

This is my first post and I am writing here to show how to hide index.php on IIS7. This solution works perfectly for me:





Make sure you have installed URL Rewrite on your IIS7. That means you can find this tool on the home page when you open your IIS7 manager.


Create a web.config file under \frontend\web or \backend\web or other directory under your need.


<?xml version="1.0" encoding="UTF-8"?>




<directoryBrowse enabled="false" />




        <rule name="Hide Yii Index" stopProcessing="true">

            <match url="." ignoreCase="false" />


            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />

            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />


                <action type="Rewrite" url="index.php" appendQueryString="true" />




 <modules runAllManagedModulesForAllRequests="true" >

      <remove name="UrlRoutingModule"/>    






Make your urlManager as the following.

‘urlManager’ => [

    'class' =&gt; 'yii&#092;web&#092;UrlManager',

    'enablePrettyUrl' =&gt; true,

    'showScriptName' =&gt; false,

    'enableStrictParsing' =&gt; false,


Then, it will make your url clear without index.php in the middle of it.

Remember, do not do anything else or you will not get the server run successfully. Eg, do not put web.config under other folder such as root level folder as other tutorial said.

All these works for me. Hope this helps. Thanks for reading.

[color="#006400"]/* Moved to Tips, Snippets and Tutorials */[/color]

Hi Fallie,

It works, thanks :) :rolleyes: