Removing index.php? on Windows IIS
Posted: 16 July 2007 09:11 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  98
Joined  09-19-2006

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.

Profile
 
 
Posted: 19 July 2007 09:23 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31267
Joined  05-14-2004

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. =)

 Signature 
Profile
MSG
 
 
Posted: 20 July 2007 07:55 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  98
Joined  09-19-2006

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

Profile
 
 
Posted: 20 July 2007 10:18 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31267
Joined  05-14-2004

You rock, thank you!!

 Signature 
Profile
MSG
 
 
Posted: 29 August 2007 03:58 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  170
Joined  12-20-2005

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

Profile
 
 
Posted: 29 August 2007 04:23 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  13102
Joined  05-15-2004

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?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 29 August 2007 10:16 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  98
Joined  09-19-2006

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.

Profile
 
 
Posted: 29 August 2007 10:26 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  98
Joined  09-19-2006

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!

Profile
 
 
Posted: 13 August 2008 09:20 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  1
Joined  08-13-2008
bcartier - 16 July 2007 09:11 AM

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?

Profile
 
 
Posted: 13 August 2008 09:39 AM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  98
Joined  09-19-2006

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

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 61001 Total Logged-in Users: 30
Total Topics: 73769 Total Anonymous Users: 21
Total Replies: 397959 Total Guests: 484
Total Posts: 471728    
Members ( View Memberlist )