Posts Tagged ‘IIS’

Making your .Net HTTP module for URL rewriting work in IIS

Wednesday, July 15th, 2009

For an application that is currently under wraps we needed to implement URL rewriting. We did this using a technique that involves the use of HTTP modules and is detailed on this site http://www.knowlegezone.com/documents/89/Simple-AspNet-Url-Rewriting-Tutorial-Http-Modules/

When we attempted to upload the HTTP module for some reason it simply wouldn’t fire and therefore our URL rewriting didn’t work.

After some furious Googling we came across the solution to this problem. Here’s the steps we took:

- Load up IIS management console
- Load properties for the affected site
- Open the Home Directory tab
- Click the application configuration button
- Click the Insert button and enter a path to the file that we wish to process requests. In this case the file is c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
- Untick the option to check that file exists
- Click OK on all of the screens and close out of the management console

Your URLs will now be rendered accordingly using your HTTP module. Not simple but at least you know how!

Pretty WordPress Permalinks in IIS

Wednesday, May 13th, 2009

We desperately wanted www.dotnetblogengine.net to be better than Wordpress but it wasn’t.  Not only that, the community support available for Wordpress is astounding.

One issue we couldn’t find an easy way around was the implementation of pretty Permalinks for our blog.  What’s a pretty Permalink we hear you ask?  By default a WordPress blog post would have the Permalink http://atlascs.co.uk/blog/?p=N.  This is both impossible to understand and not very useful.  Whereas we wanted our Permalinks to be far more readable to the human eye, and include information regarding what the blog post is about.  This is also useful for SEO purposes but that’s an entirely separate discussion.

The usual approach to implement this functionality is the use of a .htaccess file but this is only applicable to Apache. We’re running our website on Windows Server so this isn’t an option.

After hunting around for a simple solution we finally found one by Einar Egilsson.

To implement this solution follow these simple steps:

  1. Take this file, and put it in the root of your Wordpress site (rename .txt to .php)
  2. Set your sites 404 page to point to the wordpress-404.php URL.  Most control panels at web hosts allow you to do this. If you’ve got the option to select between FILE and URL then choose URL.
  3. Go to Options -> Permalinks in your Wordpress admin page, and choose an appropriate structure for your links.  We chose Custom with this pattern:
    /%year%/%monthnum%/%day%/%postname%/

Simples!  Your Wordpress posts will now display with easy to read Permalinks and your site will be much easier to navigate.  We use this solution on a number of our sites including this blog, our Business Rate Relief site and Software Development website.

Enjoy!


Bookmark and Share