EllisLab text mark
Advanced Search
1 of 2
1
   
Removing index.php? on Windows IIS
Posted: 16 July 2007 11:11 AM
Joined: 2006-09-19
101 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.

 
Posted: 19 July 2007 11:23 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-14
20504 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. =)

 
Posted: 20 July 2007 09:55 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2006-09-19
101 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..

grin

 
Posted: 20 July 2007 12:18 PM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-14
20504 posts

You rock, thank you!!

 
Posted: 29 August 2007 05:58 AM   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2005-12-20
36 posts

Hi bcartier,

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

Cheers,
Steve

 Signature 

Steve P. Sharpe
Creative Director @ Gleam.

http://madebygleam.com

 
Posted: 29 August 2007 06:23 AM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-15
29075 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?

 
Posted: 29 August 2007 12:16 PM   [ # 6 ]   [ Rating: 0 ]
Joined: 2006-09-19
101 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.

 
Posted: 29 August 2007 12:26 PM   [ # 7 ]   [ Rating: 0 ]
Joined: 2006-09-19
101 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!

 
Posted: 13 August 2008 11:20 AM   [ # 8 ]   [ Rating: 0 ]
Joined: 2008-08-13
74 posts
bcartier - 16 July 2007 03:11 PM

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?

 
Posted: 13 August 2008 11:39 AM   [ # 9 ]   [ Rating: 0 ]
Joined: 2006-09-19
101 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”.

Here’s the docs for modifier flags on the CodePlex site

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!)

 
Posted: 03 October 2008 06:05 AM   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-22
22 posts

Worked Great For Me…!

 
Posted: 04 October 2008 10:46 AM   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2008-02-14
1142 posts
theamk - 03 October 2008 10:05 AM

Worked Great For Me…!

what did you use?

 Signature 

Digital Evangelist | ghijk Ltd | Follow me on Twitter | Pro Network | EE UK Hosting

 
Posted: 28 January 2009 02:22 AM   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-22
22 posts
Steven Grant - 04 October 2008 02:46 PM
theamk - 03 October 2008 10:05 AM

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.!

 
Posted: 10 February 2009 08:45 PM   [ # 13 ]   [ Rating: 0 ]
Joined: 2008-11-27
31 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

 
Posted: 10 February 2009 10:00 PM   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-22
22 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.

 
Posted: 10 February 2009 10:58 PM   [ # 15 ]   [ Rating: 0 ]
Joined: 2008-11-27
31 posts

Thanks studio AMK!

Our host followed the instructions described on the ISAPI module’s page. Is that different from your suggestion?

Cheers,
Bronwen

 
1 of 2
1