Weird Route Behavior Under Iis

I am having a very weird problem with routes under IIS. My server is located under D:\webroot\volunteers and the structure is in the following way:

  • volunteers

– components

– controllers

— HomeController

— AdminController

– extensions

– runtime

– lib

— yii

– config

— config-main.php


— index.php

And here is the config-main:

return array(


	'runtimePath'=> realpath(ROOT.'/runtime'),












			'rules' => array(

                            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',





	/* .... */


the index.php

define('ROOT', dirname(__DIR__));

require_once (realpath(ROOT.'/lib/yii/yii.php'));

$config = include(realpath(ROOT.'/config/config-main.php')),

Yii::setPathOfAlias('root', ROOT);


and the web.config:

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




<directoryBrowse enabled="false" />




        <rule name="hide-index-php-yii" 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" />







The problem:

When I am in a controller (lets say ‘admin’ but it applies to all), Yii::app()->controller->createUrl(‘view’,array(‘id’=>1)) should create ‘/admin/view/id/1’, but it creates url ‘/volunteers/public/admin/view/id/1’. I never had a problem like that on a linux system but at work I have no choice other than using IIS7. What can I do to fix this?

  • Gasim