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.

Issue with Mura CMS, ColdFusion, ISAPI and IIS6

Awhile back I ran into an issue installing Mura CMS on a dedicated Windows server running, ColdFusion, ISAPI and IIS6. The issue wasn't blatantly obvious at first because Mura would install just fine and the home page would show up so I thought everything was just fine. However, once I began adding pages to the site and then attempted to view those pages, they wouldn't show up. I would get the ever popular 'The page cannot be found' screen. The first thing I did was check some other Mura sites I had already had installed on the server and each one of them had the same issue. This was extremely odd to me because all of my Mura sites had worked just fine before and I never noticed any problems.

So after tinkering around a little I began thinking about any software I had installed recently that might even remotely affect what was going on. Well, the only thing I could think of was ISAPI. I had just installed it with the previous day or so and wasn't really using ISAPI yet. So I uninstalled it, then checked my sites and they all seemed to work just fine. Well, that's great, isn't it? Sure, if you don't really use or need ISAPI, which was my case at the time so I just went about my business and never dug any further into the issue.

So, a few months went by and some developers who were in the process of evaluating Mura shot me a message asking for a little direction on a problem. "We have Mura up, but cannot go to sub pages. I think it is a SEO URL thing that IIS6 is not handling correctly ..." and they attached a couple of screen shots for me to look at. It took me a minute to remember, but I asked them if they had ISAPI installed. Sure enough, they did. So I proceeded to let them know if my recent experience, but wasn't able to help them really solve the problem ... because see, they actually used ISAPI and needed to have it play nicely with Mura.

A short time later, one of the developers had a "eureka!" moment. In hopes of guiding any other people running into this problem, I've opted to post his entire response below. Many thanks (and congrats) to Ken Payne for solving this problem!

Steve,

I just figured out our iis6/cf8 404 problem and I thought you might like to know what its was.

By default CF8 is not SES enabled.  I saw how to correct this early on in my investigation, by uncommenting the appropriate entries in the web.xml file.  This had no apparent effect and we assumed it wasn't even hitting CF anyway since it was a IIS 404 error.  So after your hint that it may be ISAPI we edited IIS and did a restart and voila the SES URL's now worked.  On 1 but not on the other 2 installs.  I hadn't restarted the other 2 cf instances after editing their web.xml... 

So after monkeying with restarting IIS and the other CF instances they magically worked at some point.  Enter the new developer with his own CF instance and we have the same problem.  It didn't take me long to puzzle it out by dumb luck on my first try.

So the correct sequence is:

  • Edit web.xml to enable ses
  • Restart the CF instance
  • Restart IIS
  • Done!

So simple once I see what's going on.   IIS was smart enough to know that CF didn't have a servlet for handle the ses url so it just didn't pass it.  This was not obvious since at one point it did indeed pass it on during my testing when I re-commented the ses servlet declarations and tried accessing with ses url.  But of course I had not restarted IIS yet so it thought CF could handle it etc.

Hope that made sense.

© 2017, 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