If you aren’t using a CMS/Blogging System (i.e. Drupal, WordPress etc.) then why not create a custom rewrite rule to strip your directory files of their extensions for your HTML5 Boilerplate
.htaccess file. This customization allows your site to direct users by the plain old file name rather then having to add the file extension at the end. The result will give us www.mysite.com/thefile as opposed to www.mysite.com/thefile.html. Both ways can still be used, but the new default will now be the former rather than the latter. Since this customization is a personal preference to each project need, the HTML5 Boilerplate does not provide this rule by default in their
Regular Expressions ahead. Enter at your own risk!
To implement this server–side magic you will need the ability to edit your
.htaccess file and insert the following code given below based on your desired configuration. If you are a Mac user then you are probably wondering why you can’t see the
The reason is by default the Mac OS hides files such as
.DS_Store or in our case
.htaccess. In order for us to see and edit this
.htaccess file we must enable hidden files by use of a great application I use called TinkerTool. TinkerTool allows us to activate hidden features in the Operating System and in some of the applications delivered with the system as well. To activate this feature from within TinkerTool simply check the box found next to “Finder Options” with the label “show hidden and system files.”
For further reading about URL Rewrites visit the Apache Project online documentation http://httpd.apache.org/docs/2.2/rewrite.
This post will be updated frequently as new techniques are implemented or changed as we evolve with the technology. If you have a great custom rewrite rule then please share it with the world by leaving your comments or suggestions.
|regular expression character meanings based on apache server project documentation. http://httpd.apache.org/docs/2.2/rewrite/intro.html|
|$||The other anchor, this matches the end of the string.||a$ matches a string that ends with a.|
|.||Matches any single character||c.t will match cat, cot, cut, etc.|
|*||Repeats the previous match zero or more times.||a* matches all the same things a+ matches, but will also match an empty string.|
|^||Called an anchor, matches the beginning of the string||^a matches a string that begins with a|