wp_url_rewriting:URL Rewriting for WordPress under IIS (V 2.1)

This ISAPI filter removes the index.php from WordPress permalinks on Windows IIS,making your permalinks more pretty and SEO friendly.

Because IIS does not support mod_rewrite module for rewriting URLs, if you are running WordPress on Windows IIS,whenever you try to use Permalinks, you always get something like this:

http://www.yourdomain.com/index.php/2006/09/02/…../

this ISAPI filter can remove ugly "index.php" from the URL automatically.it’s easy to use,just install it and no further configuration is necessary.

download wp_url_rewriting

Key benefits:

  • Speed.

    this URL Rewriting engine is writing in C++,because it’s designed dedicated for WordPress,so the program’s logic is very simple and no regular expression is used.it’s extremely faster than other rewriting engines on the IIS platform.
  • Support Multiple WordPress sites on one server.
  • No configuration is needed

    This URL Rewriting engine will automatically detect all WordPress sites on your server,and generate URL rewriting rules for each of them.

Living Demo

You can take my site as a living demo, navigate through my sites,watch the ‘pretty’ address in the browser.

Limitation

You must have administrator privileges on the target server in order to install this plugin.

Installation

1). Copy wp-url-rewriting.dll to the target machine and register it as an ISAPI filter using IIS MMC snap-in. wp-url-rewriting.dll can be registered at either the site level or the global level.Note:if WordPress is not installed in the root directory of your site,you should setup it as a virtual directory.

2). after register,Login to your WordPress admin panel->options->Permalinks,make sure you have removed the index.php from your permalink structure.

3). Do a little hack to WordPress file ‘link-template.php’ to make paging works well for categories:(NOTE: You don’t need to do this step if you are using WordPress 2.3.0 or newer)

open file /wp-includes/link-template.php and find the following code:

function get_pagenum_link($pagenum = 1) {

 global $wp_rewrite;

 $qstr = $_SERVER['REQUEST_URI'];

 $page_querystring = "paged";

 ...

}


Replace it with:

function get_pagenum_link($pagenum = 1) {

 global $wp_rewrite;

 $qstr = $_SERVER['PATH_INFO'];

 $page_querystring = "paged";

 ...

}

Revision History

  • version 2.1 -2007-8-29
    • Fixed a bug that may cause rewriting failed if there are many blogs under a single site.
  • version 2.0 -2007-8-17
    • no configuration file needed.This version automatically generate URL rewriting rules for each WordPress sites on the same server.
    • Support multiple WordPress sites on the same server.you can install this filter at the global level to support multiple WordPress sites on your server.
  • version 1.1 – 2006-11-1
    • optimize algorithm.
    • exclude directories : wp-admin,wp-content from the url rewriting rules.
  • version 1.0 – 2006-9-2
    • Initial Version

this ISAPI filter has been build with /MT switch(multithread, static CRT) ,if you failed to load this plugin,download vcredist_x86.exe from microsoft,run it on the target computer,this installs all Visual C++ libraries as shared assemblies.

Please feel free to report any bugs.

This project is licensed under GNU General Public License 2.0.

Related posts:

TAGS: , , , , , , ,


457 Comments »

« Previous4645444342414039...21Next »
Murat Demirci On June 12th, 2010 at 2:15 am (#)

This ISAPI filter does not work for BuddyPress.  posts and wordpress works fine but BuddyPress pages cannot be found. How can i solve this problem?

使用固定链接 | Citi On June 8th, 2010 at 5:42 pm (#)

[...] URL Rewriting for WordPress under IIS by Dean Lee [...]

vatan On June 2nd, 2010 at 7:46 pm (#)

hey
how i change slug? from dash to +
example.com/this-is-your-site
example.com/this+is+your+site

audrey On June 2nd, 2010 at 9:32 am (#)

Hi, I just downloaded this file. I am a new user and a bit confused. What I was told is that every time I post a blog, wordpress should automatically make that post's headline to a URL, so it will be more seo friendly. Is this download what I needed? Please someone HELP.
Thanks

roryok On May 18th, 2010 at 10:30 pm (#)

Hi Dean

This is a great solution, that doesn't need rules to be configured, but is there any way to add a few extra rules anyway? Say I want a direct link to a category along the lines of http://mysite.com/designs – can I set up a rule for this somewhere using your ISAPI rewriter? 
Best Regards,
Rory

使用WordPress固定链接 – 对比----想象 On May 9th, 2010 at 2:10 am (#)

[...] URL Rewriting for WordPress under IIS [...]

使用WordPress固定链接 « Escope On May 8th, 2010 at 1:46 pm (#)

[...] URL Rewriting for WordPress under IIS [...]

WordPress 固定链接设置方式 | 诺哥 On April 14th, 2010 at 10:04 am (#)

[...] URL Rewriting for WordPress under IIS by Dean Lee [...]

Илья On March 30th, 2010 at 2:44 am (#)

Сборник книг разного жанра и напрвалений – периодическая литература, газеты, журналы, фантастика, любовные романы, детективы и многое другое

brad Sonter On March 22nd, 2010 at 1:06 pm (#)

Thank you very much Dean, I have spent a few days researching the best way to get wordrpess pretty permlinks to work on our windows 2003 SBS and your solution is by far the simplest and cleanest way to remove the /index.php from permalinks. In addition to wordrpess permalinks our site has some hard coded PHP url’s which your solution works with also, but if you don’t have the site on the root of your IIS website, ie in a virtual directory, you can use <? php bloginfo (‘url’) ?> at the front of the Href and all links will work perfectly. Thank you again for spreading sanity across the web.

« Previous4645444342414039...21Next »

Leave a comment


(will not be published)