Yii url rewrite under iis

Hi,

I had some problems setting urlrewrite under iss server, since its rules doesnt reflect the apache structure. I am guessing you have set your urlManager rules as well as set its urlFormat to ‘path’ and set the showScriptName to false.
So here is what you can do, and it really is a time saver:

1. Make sure you have the URL Rewrite module installed. Can be found here: http://www.iis.net/download/URLRewrite
2. Open the IIS Manager (run -> inetmgr)
3. Select your site you wish to add the rule to (for example: Default Web Site)
4. Double click the URL Rewrite, which will open the module interface
5. Click on the Add rule(s)…
6. Select the blank rule from the selection
7. Give it a name and write the following pattern using Regular expressions: ^nameOfTheSiteYourUsing/.+ (This will match your url)
8. Set the conditions like this: click add and from Check if input string select “Is Not a file” and “Is Not a directory”, you will have to do this twice for each of them
9. Set the action properties to this: /nameOfTheSiteYourUsing/index.php/{R:0}

And thats it. You can set this for any site your developing with Yii.
I hope this tutorial comes in handy for anyone.

Thank you for reading

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s