created in the spirit of Ruby on Rails.
Making URLs prettier using URL rewriting.
URL rewriting is a completely optional feature of Wheels, and all it does is get rid of the index.cfm part of the URL.
For example, with URL rewriting off, a URL in your application could look like this:
http://localhost/index.cfm/blog/new
After turning on URL rewriting, it would look like this:
http://localhost/blog/new
Combine this with the routing functionality of Wheels, and you get the capablility of creating some really human-friendly (easier to remember, say over the phone, etc.) and search engine friendly URLs (easier to crawl, higher PageRank, etc.).
Unfortunately, if you're running your Wheels site in a subfolder of another site, you will not be able to turn on URL rewriting (at least not without making some custom changes to your rewrite rules), so we recommend running the Wheels site as a stand-alone site whenever possible. If you've met this one requirement and want the shortest and prettiest URLs possible, then just follow the instructions below.
rewrite_module has been loaded by ensuring there is no pound sign before the line that says LoadModule rewrite_module modules/mod_rewrite.so in the httpd.conf file.AllowOverride to All under the Directory section corresponding to the website you plan on using Wheels on (still inside the httpd.conf file).That should be it, in fact, on some Apache setups you don't have to do anything at all. Apache will pick up and use the rewrite rules specified in the .htaccess file on server start-up.
Unfortunately, there is no built-in URL rewriting mechanism in IIS, so getting Wheels working with pretty URLs is a little more complicated than with Apache. Here's what you do:
Now restart your web server and enjoy those fancy new URLs. :)
Comments
Read and submit questions, clarifications, and corrections about this chapter.
[Add Comment]
Thank you for the link to download ISAPI filter. After watching the blawgh video I started searching for an URL rewrite utility for IIS but only found a tool which cost over $99. Good thing somebody has posted the above URL.
Best
Sam
# Posted by ColdFusion Developer | 11/9/2008
I installed IIS7 and downloaded a simple install for URL Rewrite by Microsoft from http://www.iis.net/1692/ItemPermalink.ashx
If you too are running IIS7, you can you use my web.config file and place it to the root of your site after you have installed the utility.
The "web.config" file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="CFWheels Rule">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|rewrite.cfm|index.cfm)" />
</conditions>
<action type="Rewrite" url="/rewrite.cfm/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
This works great and amazingly cool.
Best
Sam
# Posted by ColdFusion Developer | 11/22/2008
# Posted by Pushpa Gupta | 12/25/2008
# Posted by tsqware | 6/21/2009
# Posted by Per | 6/21/2009
# Posted by reinhard | 6/29/2009
# Posted by Per | 6/29/2009
# Posted by reinhard | 6/29/2009