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.
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
[...] 在 Codex 的 Configuring Permalinks 有??到幾個解決方案,以我??儉用的個性來說, URL Rewrite 還滿?用的。若?需?使用在 wordpress 上,Permalinks for IIS using 404 Redirect 則是?? wordpress 的簡易解決方案,以下就?微介紹一下這個方案。 [...]
[...] Permalinks on IIS [...]
[...] It ended up taking me about 4 hours total to find a solution and I don’t want anyone to go through what I just did. While it wasn’t completely smooth KeyboardFace’s page on how to create a function similiar to Mod_Rewrite on an IIS server for WordPress save me. Hallelujah. [...]
[...] Well, almost success. I still had a problem. I had been using Wordpress’s pretty permalinks which do not natively work in IIS, because IIS does not support mod_rewrite. This is a problem for me, after all I had been around for 2 years and my pages are all indexed by a number of search engines. I turned to the web and found an incredibly helpful person in Tom over at KeyboardFace. Tom wrote a slick little ASP script and how-to so that you can get Permalinks for Wordpress working in IIS. The process is relatively simple, though I’ve had some issues that I believe are related to not being able to set my custom error page to be of type “URL” instead of “File” or “Default.” You can comment on your IIS Wordpress Permalinking experiences here. [...]
[...] The problem with my attempt at a clever URL rewriter that didn’t rely on a bizzare/slow automatic 404 error handler was great, in theory, until it occurred to me that the ASP.NET 2.0 engine wouldn’t actually ever fire as the result of a request targeted at anything that doesn’t have an ASP.NET file extension, thus my fantasy of targeting virtual URLs and simulating the apache mod_rewrite() command for URL rewriting went up in some. IIS 7.0 looks like it will be able to offer this kind of virtual URL natively to ASP.NET without having to use ISAPI filters (if you use a shared host, even one as good as DiscountASP.NET, they will not let you install one, ever). [...]
[...] using a custom 404 redirect as explained on the Keyboard face blog. [...]
[...] De plus, afin de pouvoir profiter des permalink sous toutes ses formes et sans le "/index.php/" nous devions utiliser soit une astuce grâce aux erreurs 404 ou soit (et pour être plus propre) un module d’ URL Rewriting comme celui de Jon Tackabury que j’ utilise pour ce blog et disponible sur IIS.net. A ce sujet, vous retrouverez sur le site de WordPress plus d’ informations sur les permalink et IIS. [...]
[...] Permalinks on IIS [...]
this errorpage.asp will make an error if the post title has a single quote in it. What\’s the fix?
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/
This works well but causes a problem with Frontpage. On IIS, if you install Frontpage then permalinks will crash. HELP?
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
and also tell me taht your solution will work with wordpress 2.6
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
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.
[...] to http://www.keyboardface.com for providing the answer.Click here to get the original [...]
[...] what is listed in Google. Turns out this problem had been resolved by the community at large and with a little hack we had all of our Google ranked pages back and working [...]
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
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?
[...] http://www.keyboardface.com/IIS-Permalinks/ – 404 page solution [...]
[...] http://www.keyboardface.com/IIS-Permalinks/ [...]
[...] http://www.keyboardface.com/IIS-Permalinks/ [...]
Actually in wp new beta this method works again!
Absolutely brilliant, thank you thank you thank you
[...] Version (see here for referred article) – Download files here – Upload htaccess.php and errorpage.asp into the root [...]
great..thanks and thanks again
[...] Codex has a very useful page about working with permalinks, there’s one solution that uses 404 error pages, however when you look at what it does it’s very slow and again very nasty. The 404 error solution [...]
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
[...] Codex has a very useful page about working with permalinks, there’s one solution that uses 404 error pages, however when you look at what it does it’s very slow and again very nasty. The 404 error [...]
[...] Using Permalinks section on the Wordpress page has a lot of info on this and it links to one solution that uses custom 404 pages to make this work but unfortunately I don’t think it’s a very good solution at all. What it [...]
[...] Using Permalinks section on the Wordpress page has a lot of info on this and it links to one solution that uses custom 404 pages to make this work but unfortunately I don’t think it’s a very good solution at all. What it [...]
[...] Using Permalinks section on the Wordpress page has a lot of info on this and it links to one solution that uses custom 404 pages to make this work but unfortunately I don’t think it’s a very good solution at all. [...]
[...] This solution supercedes the ASP solution. [...]
[...] http://www.keyboardface.com/IIS-Permalinks/ [...]
i was struggling with this problem from few days, and after search so much stuff i got solution and now i have pretty permalinks
in my self hosted (IIS7+ windows Server)blog.
(Prerequisites: PHP5.0+ Version and FAST CGI SCRIPT – Don’t use ISAPI Filter)
I have made one web.config you need to put that file in your root directory and done.
http://www.geekblogger.org/2010/03/how-to-set-pretty-permalinks-in.html