This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Removing index.php? on Windows IIS

July 16, 2007 11:11am

• #1 / Jul 16, 2007 11:11am

Brent Cartier

87 posts

Just thought I’d share a success story in finally achieving clean urls on an IIS server. I installed a free ISAPI rewrite module from CodePlex. After that just use the following rules in the ISAPI module’s ini file (see codeplex documentation for ini details):

#Change the following to your renamed system folder path:
RewriteRule ^/system/(.*)$/system/$1 [I,L]

#Add rules for folders you want to accept without rewriting:
RewriteRule ^/images/(.*)$/images/$1 [I,L]
RewriteRule ^/styles/(.*)$/styles/$1 [I,L]
RewriteRule ^/themes/(.*)$/themes/$1 [I,L]

#This allows querystring to be added to the url (like {path=logout} )
RewriteRule /(.*)\?(.*)$/index.php\?q=$1&$2 [I,L] #This removes index.php? from the urls RewriteRule ^/(.*)$ /index.php?/\$1 [I,L]

In the EE Control Panel:

1) Remove ‘index.php’ from System Preferences > General Configuration: Name of your site’s index page. (should now be blank)

2) Make sure “Force URL query strings” is set to “No”

That’s it! I really struggled to get this going so I thought it might help someone else in the same situation.

• #2 / Jul 19, 2007 11:23pm

Lisa Wess

20446 posts

Hi, bcartier! Very, very nice.  I hope you will consider adding this to the wiki article on removing index.php, as I’m sure that many IIS users would love to be able to find this information in the future. =)

• #3 / Jul 20, 2007 9:55am

Brent Cartier

87 posts

OK Lisa, I’ve updated the wiki with a link to the ASAPI module and a link back to this thread. I hope it helps prevent some headaches..

• #4 / Jul 20, 2007 12:18pm

Lisa Wess

20446 posts

You rock, thank you!!

• #5 / Aug 29, 2007 5:58am

Steve [at] Gleam.

27 posts

Hi bcartier,

Out of interest, how did you install ISAPI. Do you need root access to the box, or just ftp?

Cheers,
Steve

• #6 / Aug 29, 2007 6:23am

Ingmar Greil

29243 posts

I don’t know about IIS, but with mod_rewrite, isn’t the [L] flag only meant to appear once, for the “L"ast rule?

• #7 / Aug 29, 2007 12:16pm

Brent Cartier

87 posts

Hi Steve,

When I installed it, I had a Remote Desktop Connection… There are some configuration changes to do in IIS Manager. If I remember correctly, the installation was documented fairly clearly though.

• #8 / Aug 29, 2007 12:26pm

Brent Cartier

87 posts

Ingmar, I think you’re absolutely right. The L modifier means that this will be the last test if there is a positive match. Hmmm, I might have to double check my logic in the example then…

Thanks for pointing that out!

• #9 / Aug 13, 2008 11:20am

luvd

52 posts

That’s it! I really struggled to get this going so I thought it might help someone else in the same situation.

I’m trying to use your settings with the latest stable version of Ionics Isapi Rewriter (1.2.14), but get different results.

This is the output, using the supplied TestDriver.exe tool:

Processing URLs…(..\tests\ee\SampleUrls.txt)
REWRITE '/' ==> '/index.php?/'
REWRITE '/mypage' ==> '/index.php?/mypage'
REWRITE '/index.php?/mypage' ==> '/index.php\?q=index.php&/mypage'
REWRITE '/system' ==> '/index.php?/system'

Because of this, I’m unable to access my Admin control panel. Do I need different rules for this version of Isapi Rewriter?

• #10 / Aug 13, 2008 11:39am

Brent Cartier

87 posts

Hi luvd,

You may need to look at your modifier flags. It seems that it’s applying the index.php? redirect to your system folder, which shouldn’t happen if the rule for your system folder appears first in the ini file, and is marked with the modifier flag ‘[L]’ for “Last Rule”.

I should note that I’m no longer using this solution, so I haven’t kept up to date with the newer versions. I’m hosting on an Apache server now (thank goodness!)

• #11 / Oct 03, 2008 6:05am

studioamk

18 posts

Worked Great For Me…!

• #12 / Oct 04, 2008 10:46am

Steven Grant

894 posts

Worked Great For Me…!

what did you use?

• #13 / Jan 28, 2009 2:22am

studioamk

18 posts

Worked Great For Me…!

what did you use?

Sorry for my late reply.

I used Ionics Isapi Rewrite Filter (IIRF) .

Here’s the tutorial; How URL rewritting can be done in IIS.

Good Luck.!

• #14 / Feb 10, 2009 8:45pm

bronwen

22 posts

Hi,

We’re having trouble getting rid of index.php.

Our site is hosted on a windows IIS server.

Our web host followed the instructions described in Brent Cartier’s post to set up the ISAPI module’s ini file and we have followed the instructions in ee’s control panel.

The result was that it overrides the url but the links are not working. If you click on the overwritten url example.com/blog the browser only opens a 404 page.

Do you know if having index.php is a problem for SEO?

We’d appreciate any help.

Bronwen

• #15 / Feb 10, 2009 10:00pm

studioamk

18 posts

Hi… Bronwen,

You should separate the task into 2 steps.

1. Implementation of URL Rewriting in IIS and
2. Removing index.php in EE.

For step 1, go to there.
http://studioamk.com/blog/index.php/posts/35-tutorials/76-url-rewriting-in-iis

For step 2, please refer to the first post of this thread.

ExpressionEngine News

#eecms, #events, #releases