Knowledge Essentials - 3Essentials Hosting

Using Permalinks With Wordpress On Windows Hosting

Article ID: 424

 Back to Search

Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to refer to your article (or section), or how you might send a link to your story in an e-mail message. Especially when they are used to link to individual postings, once a story is posted, the URL to it should be permanent, and never change. Hence.. permalink.

By default WordPress uses web URLs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links.To use the two pre-defined permalinks format you need to:

1. Enable these two settings in your PHP configuration file. On Windows servers this will in the root of the application and named php-fcgi-cgi.ini:

  • cgi.fix_pathinfo = 1
  • cgi.force_redirect = 0

 

This will allow these two permalink options to work:

Date and name based:
http://YOURDOMAIN.COM/index.php/2007/11/21/sample-post/

Numeric:
http://YOURDOMAIN.COM/index.php/archives/123

2. Make PHP is enabled on your site set to use the CGI and not the ISAPI version.

Note: If your site is hosted on servers web18, web20, web22, web24 then PHP5 must be enabled manually by our support team. Your control panel on those servers only supports PHP4. This means that in the Plesk Control Panel, PHP will actually be unchecked or the control panel will overwrite the PHP5 configuration on the site.

Notice that you still need to have the index.php file in the permalink structure.  This permalink option uses wordpress to rewrite the URL format using native PHP.

ADVANCED - USE A ISAPI URL REWRITER

If your site is hosted on a Windows platform with IIS7.5, there is a built-in URLRewrite module available to use. Please see KB1256: URLRewrite/mod_rewrite for Windows on IIS7.x

On Windows with IIS6, you will need to have a URLRewrite mod installed to the site.

If you wish to use a Custom Permalink Format and do more advanced URL Rewriting then you will need to ask support to install the IIS ReWrite DLL for your site. You can then use regular expressions to do URL rewriting much like that of the linux mod_rewrite module.

Here is an example of entries needed in your IsapiRewrite4.ini. This file will be located in your httpdocs directory. This example is written for a wordpress blog that is:

1. Installed in the root of the website.
2. Uses a Custom Permalink of:  /%post_id%/%category%/%postname%.html

#RewriteLog C:\Temp
#RewriteLogLevel 3
# MaxMatchCount
#
# Specifies the maximum number of sub-expression matches to
# capture for a single pattern. This specifies the size of the
# array in the C module.  If you have a pattern with more than
# the default number of matches, set this number.
#
# The default is 10.

MaxMatchCount 10


#
# /content/blogcategory/0/33/
#
# should translate to
#
# /index.php?option=com_content&task=blogcategory&id=0&Itemid=33

#Expects a Custom wordpress permalink of:  /%post_id%/%category%/%postname%.html

RewriteRule ^/wp-admin/([^/]+)$  /wp-admin/$1
RewriteRule ^/([^/]+)/([^/]+)/([^/]+).html$  /index.php?p=$1
RewriteRule ^/comments/feed /index.php?feed=comments-rss2
RewriteRule ^/([^/]+)/([^/]+)$  /index.php?page_id=$1

#Add a rule for each page you wish to add in your blog.  Lookup the page id from the admin section of wordpress
RewriteRule ^/page1  /index.php?page_id=2
RewriteRule ^/page2  /index.php?page_id=3

#Rule for RSS Feeds
RewriteRule ^/feed /index.php?feed=rss2

RewriteRule ^/$ /index.php


IterationLimit 10
NotParsed  foo bar

Another solution exists using IIS' custom 404 redirects. It requires that you to add a custom 404 redirect, but it doesn't require you to install any 3rd party mod_rewrite software and it also doesn't require that your permalink structure begin with /index.php/. You can read about it here: http://einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/

 

 
Downloads Associated With This Article
No downloads are currently associated with this article.