Site icon Best Managed Cloud, IT and Cyber-security in Florida

The better way to do permalinks in WordPress on Windows

Lately we’ve been blogging about WordPress here at AppliedI.net. The reasons for that are plenty but mostly it’s because many customers have acknowledged that they find it a great tool and have found these articles useful.  As Andre pointed out earlier many people are starting to use blogging tools like wordpress as a full CMS application. 

One of the great features wordpress has is that you can enable a feature called permalinks.  According to Wikipedia:

A permalink is a URL that points to a specific blogging entry even after the entry has passed from the front page into the blog archives. Because a permalink remains unchanged indefinitely, it is less susceptible to link rot.

A permalink is useful as it provides an easy to remember URL to a blog article and is also pretty search engine friendly.

How permalinks used to be done on Windows

Previously if you wanted to enable permalinks in your Windows based blog you had only a couple options:

  1. using a custom 404 redirect as explained on the Keyboard face blog.
  2. using an ISAPI filter, such as Dean Lee’s isapi filter.

These worked well and I’ve used both in blog. But today, thanks to isapi-rewrite 3.0 from helicontech.com we have a new way to do it. Helicontech’s latest version of isapi-rewrite is mod_rewrite compatible. Mod-rewrite is a URL rewriting engine used in apache web servers and since almost all PHP apps are initially written for apache based servers they make use of mod_rewrite rules. Helicontech saw this and rewrote their own isapi-rewrite tool to be mod_rewrite compatible.

This means if you have an application like wordpress that makes use of mod_rewrite you’ll be able to use the same rules and just upload a .htaccess file to your Windows hosted account and you’re done!  It couldn’t be an easier. Fortunately for you, AppliedI.net includes isapi-rewrite 3.0 for free with all shared hosting accounts so you have this functionality immediately.

How to do permalinks in wordpress in IIS6 with your blog in the root folder

Many users put their blog in their web root folder so when you go to http://www.example.com/ the blog comes up immediately. This tutorial portion assumes this is where your blog is. If this isn’t where you’re blog is please read the next section.

Once you’ve installed your wordpress blog on your site you’ll want to log into the admin section and select options and then select permalinks. You’re going to make the following changes:

1. Under Common Options:

Select Custom, specify below. Enter the custom structure as: /archives/%year%/%monthnum%/%day%/%postname%/

2. Under Optional:

We’re going to enter a category base and tag base. This is important because you’re going to categorize your articles (to make them easier for the visitors to browse) and tag your articles to help with searches and also allow your related articles to be grouped. For Category base: /category/ For Tag base: /tags/

3. Update Permalink Structure

Once these are set you’re going to click the button, update permalink structure. This is going to update these settings your database. We’re not done though. We still have to upload the .htaccess file. 

4. Create .htaccess file

You’ll create a new text file and name it .htaccess. In this text file you’re going to include the text:

# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.21

# BEGIN WordPress
# <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# </IfModule>
# END WordPress

You’re going to want to enter the text just like that and then upload this file to your website’s root folder. That’s it! Permalinks should now work.

How to setup wordpress permalinks for /blog/ on IIS6 (or windows hosting)

The steps in this section of the tutorial are just like the steps above except this assumes your blog is in a subfolder called /blog/ so your blog is accessed as: . If your blog is in a subfolder other than blog you’d change the instructions below substituting your folder name for /blog/. The only step that changes is step #4.

Once you’ve installed your wordpress blog on your site you’ll want to log into the admin section and select options and then select permalinks. You’re going to make the following changes:

1. Under Common Options:

Select Custom, specify below. Enter the custom structure as: /archives/%year%/%monthnum%/%day%/%postname%/

2. Under Optional:

We’re going to enter a category base and tag base. This is important because you’re going to categorize your articles (to make them easier for the visitors to browse) and tag your articles to help with searches and also allow your related articles to be grouped. For Category base: /category/ For Tag base: /tags/

3. Update Permalink Structure

Once these are set you’re going to click the button, update permalink structure. This is going to update these settings your database. We’re not done though. We still have to upload the .htaccess file. 

4. Create .htaccess file

You’ll create a new text file and name it .htaccess. In this text file you’re going to include the text:

# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.21

# BEGIN WordPress
# <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
# </IfModule>
# END WordPress

You’ll notice RewriteBase has now changed to reflect the /blog/ folder instead of /.  That’s because we’re assuming your blog is in a subfolder named /blog/. Once you’ve modified this file, save it and then upload it into the subfolder /blog/ where your blog is stored. It’s import that the .htaccess file go in the actual folder you’re doing the rewrites on and not the parent folder.

That’s it! Permalinks should now work.

Additional Information

Permalinks are very important as you can imagine and the .htaccess rules above actually came initially from Perishable Press’s article The htaccess Rules for all WordPress Permalinks and have been updated for isapi-rewrite 3.0 compatibility.

If your hosted with a host that doesn’t support isapi-rewrite 3.0 for you blog you can learn more about our WordPress Hosting by following that link.

[optin-monster-shortcode id=”xzzfqbtytdw78gbx8gbq”]

Exit mobile version