I've finally managed to incorporate URL rewrite rules and changed the Galaxie Blog logic to use search engine friendly URL's. Search friendly URL's allow the URL to be more consistent, and eliminate information that is not important. A search friendly URL should easily convey meaning of the page.

Making this open source blog work with search friendly URL's was not a trivial undertaking. A lot of changes had to be made. Galaxie Blog now removes the '/index.cfm' string from the URL. We are also using the posted date and an easy to read entry title within the URL. Galaxie Blog also removes the '/index.cfm' string from all of the links. We don't want to have a mixture of different links that the search engine would crawl and cause duplicate content on several different pages. Additionally, Galaxie Blog will also remove the '/index.cfm' string from both the google site map and RSS feed that Galaxie Blog automatically creates for you.

To enable search engine friendly URL's in Galaxie blog, follow the two steps below.

  1. If you're using IIS, the following rule should be copied and pasted into the web.config in the root directory of the server. The URL redirection rule is between the rewrite tags below. It essentially matches all strings with 'index.cfm', and removes this string. Additionally, it sets a permanent redirect that the search engine uses when crawling your page.

view plain about
1<?xml version="1.0" encoding="UTF-8"?>
2<configuration>
3 <system.webServer>
4 <directoryBrowse enabled="false" />
5 <urlCompression doStaticCompression="true" doDynamicCompression="true" />
6        <rewrite>
7        <rules>
8         <rule name="GregorysBlog" stopProcessing="true">
9 <match url="(.*)index.cfm" />
10 <conditions logicalGrouping="MatchAll">
11         <add input="{SCRIPT_FILENAME}" matchType="IsFile" negate="true" />
12 <add input="{QUERY_STRING}" pattern=".+" ignoreCase="false" negate="true" />
13 </conditions>
14 <action type="Redirect" url="{R:1}" appendQueryString="true" redirectType="Permanent" />
15 </rule>
16        </rules>
17        </rewrite>
18 <security>
19 <requestFiltering>
20 <fileExtensions>
21 <add fileExtension=".pl" allowed="false" />
22 </fileExtensions>
23 </requestFiltering>
24 </security>
25 <httpErrors errorMode="Detailed" />
26 <staticContent>
27 <remove fileExtension=".woff2" />
28 <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
29 <remove fileExtension=".webp" />
30 <mimeMap fileExtension=".webp" mimeType="image/webp" />
31 </staticContent>
32 </system.webServer>
33</configuration>

  1. In the application.cfc template which is in the blog's root directory, search for the following string and set it to true. It should be around line 22. Note: this is not permanent. You can always reverse this and set it to false at later time if you're new server does not allow for search friendly URL's.

view plain about
1<cfset application.serverRewriteRuleInPlace = true>

That's it! You're blog should now be using search friendly URL's.

Credits:

  • I especially want to thank Caleb C. from Hostek for helping me get the IIS rule straight. The folks at Hostek have been nothing but outstanding in their service and support!

Further Reading:

Notes:

  • The search friendly URL features will be available in the next release.