Removing index.cfm From Mura CMS URLs on Windows/IIS

While it's fairly easy to find out how to remove 'index.cfm' from your URL if you are using Apache (see Jamie Krug's blog and Matt Woodward's too), I haven't found any information on how to go about doing it if you're using Windows with IIS. As with anything else in this world, there are definitely more ways than one to accomplish this. However, I hope to show you an extremely painless and easy way to set this up.

Since everyone has different configurations, I'll point out here that this should work with IIS6+.

Step 1

Purchase and install ISAPI/rewrite/3 from Helicon Tech. As of the date and time of the writing of this article, it's only $99 per server and includes a free 45-day trial period. I do NOT recommend the freeware ISAPI_Rewrite Lite version since it does not allow for distributed .htaccess configurations, directory or web site level configurations. Other Lite version limitations can be found here.

Step 2

Now we need to create and add a .htaccess file to the root of our site with the appropriate rewrite rules. However, you need to determine whether or not you want to include the 'SiteID' in the URL.

In Mura CMS, you have the option to either include the 'SiteID' in the URL (which is the default behavior) or exclude the 'SiteID' from the URL. You can alter this behavior by simply editing the settings.ini.cfm file located under the 'config' directory.

For example, locate the siteidinurls and if you haven't changed it, it's probably set to siteidinurls=1. Assuming yours is set this way, your URL would would be rendered like http://www.mydomain.com/siteid/index.cfm/path/to/page/. If you change that to siteidinurls=0, then your URL would be rendered as http://www.mydomain.com/index.cfm/path/to/page/.

So depending on whether or not you want the SiteID to appear in your URL, you'll want to use either Option A or Option B below.

Option A — Remove SiteID AND index.cfm

Update your settings.ini.cfm file with the following settings:

siteidinurls=0
indexfileinurls=0

Then, drop the following code into your .htaccess file

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^([a-zA-Z0-9/-]+)$ /index.cfm%{REQUEST_URI} [PT]

Option B — Keep SiteID but Remove index.cfm

Update your settings.ini.cfm file with the following settings:

siteidinurls=1
indexfileinurls=0

Then, drop the following code into your .htaccess file:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^([a-zA-Z0-9-]{1,})/([a-zA-Z0-9/-]+)$ /$1/index.cfm/$2 [PT]

That should be it. Hope that helps our friendly Windows IIS + Mura CMS users out there.

Peace.

Related Blog Entries

Comments
Why not use the URL Rewrite module that is part of IIS7+ ?

I use it, it works perfect. GUI based easy to configure.
# Posted By Sumit Verma | 11/5/10 8:44 AM
Thanks so much Steve. These instructions are something I've been looking for to implement on my VPS. Extremely helpful.
# Posted By Andy Peterson | 11/5/10 8:48 AM
@Sumit,
You're right, I personally don't play aroun with URL Rewrite in IIS7. However, in this case I was looking for something to use where I could easily swap a .htaccess file in/out whether my client was on Apache or IIS ... this method actually works on IIS6 too.
# Posted By Steve Withington | 11/5/10 8:49 AM
@Andy, thanks for the feedback...glad it helped!
# Posted By Steve Withington | 11/5/10 8:50 AM
I agree with @Sumit... version 2.0 of urlrewrite is available free for win server 2008 series through the web platform installer??

Why pay for what is free and just as good?
# Posted By Chris Dawes | 11/9/10 7:15 PM
@Chris,
I hear ya...but URL Rewrite doesn't support .htaccess. It's just so much easier to simply drop the same .htaccess file into any site regardless of whether someone is using IIS or Apache.
# Posted By Steve Withington | 11/9/10 7:41 PM
Hey Steve,

How do you get around using dynamic pages in Mura while using this method? I can remove the index.cfm just fine, but when I go to a login page or something (esc + L) I get a 404 because it has "index.cfm" in the url.

any thoughts?
# Posted By Ronnie | 2/4/11 2:02 PM
@Ronnie,

not sure i follow you ... i just tried this myself and it worked fine for me whether or not i have 'index.cfm' in the URL or not.

the only thing i could think of is maybe under your site settings, on the 'Extranet' tab, you have 'index.cfm' as part of the login and profile URLs ... if so, remove them and try again.

they should read: '?display=login' or '?display=editProfile'

hopefully that's what's happening.
# Posted By Steve Withington | 2/4/11 4:08 PM
You rock... that totally fixed it!
# Posted By Ronnie | 2/4/11 4:11 PM
Hi there

I have just setup a website using Mura and have just installed ISAPI Rewrite to try and get around the www.petertanswell.com/default/index.cfm from displaying in the URL.

I created a .htaccess file in the root of the site. I used the example in part A

I have ISAPI Rewrite installed.

So I browsed to the website - but still have the /default/index.cfm displaying

Would appreciate any further information. Do I need to stop and restart IIS and world wide publishing etc.
# Posted By Peter Tanswell | 2/9/11 8:00 PM
I just got into the Helicon Manager and ensure that the site was registered in the tool along with having the code below:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^([a-zA-Z0-9/-]+)$ /index.cfm%{REQUEST_URI} [PT]

I still have the /default/index.cfm being displayed - cant work out why it is still being display

Do I need to restart IIS?

Regards & thanks in advance

Peter
# Posted By Peter Tanswell | 2/9/11 8:13 PM
@Peter,
If I had to guess, I would suspect you need to edit your settings.ini.cfm file (located under '/config/').

Make sure you have the following settings in there:

siteidinurls=0
indexfileinurls=0

After you make this change (or if you already have), be sure to Reload your application. To do this, make sure you're logged into the Admin and click 'Reload Application' on the bottom of the left hand navigation.
# Posted By Steve Withington | 2/10/11 8:39 AM
I have changed the setting.ini file as required and still get the same.
# Posted By Peter Tanswell | 2/10/11 10:18 AM
@Peter,
Did you reload the application?
# Posted By Steve Withington | 2/10/11 10:21 AM
yep I reloaded the application - but same result - still see the /default/index.cfm

I have installed on the server ISAPI and it is working and followed your instructions that you had earlier on in this forum
# Posted By Peter Tanswell | 2/10/11 2:34 PM
@Peter,
These instructions are for typical Mura installations where Mura has been installed at the site root ... so if it's not working for you, I'm going to assume yours is not installed at the site root (i.e., in a sub-directory of the root).
# Posted By Steve Withington | 2/10/11 3:00 PM
@Peter,
By the way, these settings weren't available in Mura until version 5.2, and I just noticed you're currently on a 5.1 version. No worries though, unless there's more than one Peter Tanswell, I'm pretty sure I'll be helping you out directly.
# Posted By Steve Withington | 2/10/11 10:24 PM
I'd love for one of the poster who suggest using URL Rewrite instead to share how they got this working. I have yet to get both SiteID and the index.cfm removed from the url and still serve the content.
# Posted By Scott N-H | 3/30/11 3:47 PM
I have used http://iirf.codeplex.com/ which is free and it is working OK using these rules on IIS 6. My only issue is that I have to type in the address for admin now.
# Posted By Keith Ralston | 9/13/11 7:18 AM
I finally posted a follow up to this article for anyone interested in how to use the URL Rewrite Module with IIS7+ http://www.stephenwithington.com/blog/index.cfm/20...
# Posted By Steve Withington | 9/15/11 9:51 AM

© 2018, Stephen J. Withington, Jr.  |  BlogCFC was created by Raymond Camden – Version 5.9.004

Creative Commons License  |  This work is licensed under a Creative Commons Attribution 3.0 Unported License.  |  Hosted by Hostek.com