We all want pretty and search-engine friendly URLs for our blog posts. The most common format is /%year%/%monthnum%/%day%/%postname%/ as it gives users and search engines optimal information about the topic and the month of the post (er, you might want to check out the URL of this post for an example).
As it turns out, having WordPress generate such URLs is possible on IIS 6 in a shared hosting environment without much effort and there is no need to move to an Apache host with mod_rewrite etc.
The “official” procedure recommended by WordPress is here. It entails editing your Windows Server’s php.ini file. However, most shared-hosting companies (I currently use Crystaltech) will not do this for the entire server just so that your blog can have pretty URLs.
There’s a much easier way:
- Create a text file in the root of your blog and name it php.ini. Paste the following two lines:
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
- Then simply change the permalink structure in your WordPress control panel to:
To get rid of the leading “/index.php/” -which will make it easier to move to another blog engine such as Typo later-;) follow these additional steps:
- Download the WordPress – Remove Index.php from Permalinks in IIS Plugin (scroll down), and install it into wordpress (upload to /wp-content/plugins/ folder, then Activate from WordPress control panel).
- Change the default 404 error page of your IIS site. Most web hosting companies will offer a web form to accomplish this. At Crystaltech it looks like so:
Set the 404 error URL to “/index.php” or the root URL of you blog such as “/blog/index.php”. Then change the permalink structure to /%year%/%monthnum%/%day%/%postname%/.
Hope it helps.