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.
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:- URL rewriting for WordPress on IIS upgraded to version 2.0
- Boost your WordPress performance on Windows IIS 6 with FastCGI and eAccelerator in 5 minutes
- Permalinks Migration Plugin for wordpress
- URL Rewriting for WordPress under IIS has been rebuild
- Howto:Configure Spell Check with FCKEditor Plugin for WordPress
My WordPress Permalink ISAPI filter problem – How I fixed it – Remaining security Questions:
I followed the intructions at http://www.juryriggin.com/2006/11/07/
fixing-permalinks-when-using-wordpress-windows-2003-iis-60/
but the WordPress ISAPI filter created many Application log errors 2268 and 2214
I then installed the MS C++ 2005 install library (per the above link) from
http://www.microsoft.com/downloads/details.aspx?
familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
I then gave the usergroup “IIS_WPG” (created by default in IIS 6.0 W2K3) both “read” and “execute” permissions to the WordPressPlugin.dll file.
I rebooted and the filter and permalinks worked!
The question I have now is: Did I create any security holes?
******************************
Why I did what I did:
I had gone to the following site to troubleshoot my ISAPI WordPress Filter problem.
http://blogs.msdn.com/david.wang/archive/2005/06/21/
HOWTO-Diagnose-and-Fix-Common-ISAPI-Filter-Installation-Failures.aspx?
CommentPosted=true#commentmessage
It educated me and I learned that my error was :
Data: 05 00 00 00 -Win32 error 5 – NET HELPMSG 5 returns “Access is denied.”
The article then mentions:
“For IIS6 in worker process isolation mode, the process identity is configurable and is at least a member of the IIS_WPG group” (see more on the link)
That’s when I got the idea to give the user IIS_WPG “read” and “execute” permissions on the WordPressPlugin.dll file.
My ISAPI filter problem – How I fixed it – Remaining Security Questions:
I had followed the following site word for word:
http://www.juryriggin.com/2006/11/07/fixing-permalinks-when-using-wordpress-windows-2003-iis-60
but WordPress ISAPI filter was creating many Application log errors 2268 and 2214
So I then (most hazardly and without web security in mind) added the WordPress users “site_name_Anon” and “site_name_Admin” to the IIS_WPG user Group (it is creatd by W2k3 by default) and I also gave the user IIS_WPG “read” and “execute” permissions to the WordPressPlugin.dll file. **My Permalinks and ISAPI WordPress Filter now work**
The question I have now is: What security holes have I created?
******************************
Why I did what I did:
I had gone to the following site to troubleshoot my ISAPI WordPress Filter problem.
http://blogs.msdn.com/david.wang/archive/2005/06/21/
HOWTO-Diagnose-and-Fix-Common-ISAPI-Filter-Installation-Failures.aspx?
CommentPosted=true#commentmessage
It educated me and I learned that my error was :
Data: 05 00 00 00 -Win32 error 5 – NET HELPMSG 5 returns “Access is denied.”
The article then mentions:
“For IIS6 in worker process isolation mode, the process identity is configurable and is at least a member of the IIS_WPG group” (see more on the link)
That’s when I got the idea to add the WordPress users “site_name_Anon” and “site_name_Admin” to the IIS_WPG user Group (it is creatd by W2k3 by default) and I also gave the user IIS_WPG “read” and “execute” permissions on the WordPressPlugin.dll file.
Thanks Quang i am really very much thankful to you i have this problem and you have solved it thanks alot.
on this site i got many information what i needed.
On personal opinion, I find this very helpful.
Guys, I have also posted some more relevant info further on this, not sure if you find it
useful: http://www.bidmaxhost.com/forum/
[...] URL Rewriting for WordPress under IIS (http://www.deanlee.cn/wordpress/url-rewriting-for-wordpress-under-iis/) [edit] [...]
Wow this is great this works with a httpd.ini file right?
[...] it’s a thing of the past. iis, wordpress Permalink You can leave a response, or trackback from your ownsite. [...]
I just had the same problem as Andy, above. It had been working fine, but all of the sudden this morning, the DLL failed to load. Any ideas? It’s been running fine for a while.
TIA.
Very useful fashions for my diary, thanks. I have established it in the magazine. Max Maximov
We’ve been using this plugin for several months now, and out of the blue, it shutdown IIS this morning. Our event log show numerous “\WordPressPlugin.dll failed to load” errors. We hadn’t changed anything. I even tried creating a new site within IIS, but it absolutely refuses to load this DLL now. Our server is Windows 2003 R2.
Any ideas?