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:
indexfileinurls=0
Then, drop the following code into your .htaccess file
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:
indexfileinurls=0
Then, drop the following code into your .htaccess file:
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.
Comments
I use it, it works perfect. GUI based easy to configure.
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.
Why pay for what is free and just as good?
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.
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?
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.
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.
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
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.
Did you reload the application?
I have installed on the server ISAPI and it is working and followed your instructions that you had earlier on in this forum
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).
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.