Update
There is a better way to do this now. Take a look at this post that describes it. This page is kept here for all that have already installed this solution.
Original Solution – Outdated Now
This has been tested with WordPress 1.5 and 2.0
If you have any trouble installing it, you can comment here and I’ll try and help you. Also, if you successfully use this on your server, let me know in the same thread. Thanks!
Requirements
• IIS
• WordPress 1.5 or 2.0
• Ability to change your 404 error page with your web host.
Downloads
This solution requires two files: errorpage.asp and htaccess.txt or htaccess.php.
Installation Instructions
1. Log into the admin section of WordPress.
2. Click on Options -> Permalinks
3. Set your Permalink Structure to “Custom” and enter in a pattern for your permalinks. WordPress has a section that gives all of the permalink structure tags. Mine is currently set to:
Structure: /archives/%year%/%monthnum%/%day%/%postname%/
Category Base: /archives/category
4. Click Update Permalink Structure
5. Upload htaccess.php and errorpage.asp into the root directory of your blog.
6. The steps used for this next step will vary depending on your hosting provider. Essentially, what you want to do is set a custom 404 redirect to “/errorpage.asp”. It is important that the type of redirect is set to URL. (There are several options.
You can change this directly from within IIS by selecting Properties -> Custom Errors. Select 404. Edit. Set Message Type to URL (you have the option of File, URL or Default). Set it to /errorpage.asp
7. Your done! Try it out. If it doesn’t work, post a comment on my blog and I’ll attempt to help you out.
The script is now dynamic, meaning it uses htaccess.php to figure out what your permalink rules are. htaccess.php gets the rules directly from WordPress. Previous versions required you to copy/paste the rules from WordPress into htaccess.txt. This feature is still available for those that want to modify the rules from the standard that wordpress puts out.
To do this:
Get the rules either by accessing htaccess.php in a browser and then copying the source, or by navigating to the permalinks section in WordPress’ admin area.
Paste the rules directly into htaccess.txt.
Change this line in ErrorPage.asp.
Dynamic = True
Change it to:
Dynamic = False
Shaklee-NY says
this errorpage.asp will make an error if the post title has a single quote in it. What\’s the fix?
Tom says
All I can think is to remove this line:
ps = replace(ps, "'", "")
If that doesn’t fix it, you can replace it with this line:
ps = replace(ps, "'", "''")
I couldn’t test it out because we no longer use that solution on this blog. We use the updated version which can be found here:
http://www.keyboardface.com/archives/2007/09/07/update-for-wordpress-permalinks-on-iis/
Shaklee-NY says
This works well but causes a problem with Frontpage. On IIS, if you install Frontpage then permalinks will crash. HELP?
Prashant says
Hi,
I am having a domain registered on shared web hosting IIS7 I want to run wordpress paramlink but its not running i have tried your trick but its also not working its (wordpress blog) always displaying that you have got wrong url.
And also i want to run wordpress on subdomain is there any problem with that???
Thanks,
Prashant
Prashant says
and also tell me taht your solution will work with wordpress 2.6
Tom says
Prashant, IIS7 has a better and different work-around. It involves editing the web.config file.
Here’s a link to a page that goes over it:
http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/
Best,
Tom
still-struggling says
I installed wordpress on IIS and am only having one problem after the next. As described above, permalinks corrupts frontpage. So I removed frontpage. Now, my wordpress does not have a .htaccess file at all! There is a htaccess.php, but none that starts with a .
Also, I am running a classic asp website, and on the right column, I’m including a file that parses a feed from the blog. It says ‘recent posts to my blog’. It runs perfectly fine, except after includig that, within minutes the site hangs. The site will not work if it is pulling my blog feed file. So including the xml [parser crashes my site. It is using too much resources to parse. I don’t understand this problem.
Either way I love wordpress and I’m willing to persevere until I get it right. So A – gotta make permalinks work with frontpage. B – gotta make those recent posts show up nicely without overtaxing the server. And C – I’m not sure why but I downloaded the errorpage.asp from here http://www.keyboardface.com/iis-permalinks/ and it works nice, but only if the blog is in the /blog directory, not if your blog is the root of the site.
elan says
Hi, I cannot implement the pretty perma link structure in this wp blog. Can u please help me in this regard. http://blog.cfstyle.com
satish says
Hi,
It worked fine for me with the given structure and category base. But i want to use this for the permalink structure as
http://www.localsadda.com/%postname%/. How can i implement this. What are modifications need to be done?
Can you help me out?
Tomas says
Actually in wp new beta this method works again!
Arren says
Absolutely brilliant, thank you thank you thank you
E.Karnika Yashwant says
great..thanks and thanks again
B3 says
almost worked!
the only part that didnt work was the comment box is not visible, and always says you must login, even when you are. as soon as i removed the 2 files the comment box came back and said i was logged in