May
21
2006

WordPress PermaLinks in IIS without the mod_rewrite

In a previous post, I mentioned that I was investigating a way to use real permalinks without using any of the ISAPI mod_rewrite dlls. For the uninitiated, mod_rewrite is not natively supported in IIS (Window’s server), and to get the same functionality, you have to install separate programs. I’ve done that and that is how this blog has survived on a Windows server for the past year or so.

I was convinced that needn’t be the case though. There must be a way to have permalinks without having to install a whole separate mod_rewrite program (or extension). I detailed my plan in this post.

Well, I finally got around to it – and the plan worked!

Here’s the gist of it. It uses custom 404 redirect to send all “Page Not Found” errors to a script that reads a bunch of regular expressions (don’t worry, you don’t have learn regular expressions to use this) and figures out what page to feed back.

Now, some people may find my solution a bit odd considering it is written in ASP. You used ASP to extend wordpress?? Yes, and it worked :) .

More detailed instructions, and a link to the needed files are located here:

WordPress Permalinks in IIS

Share and Enjoy:
  • del.icio.us
  • digg
  • Furl
  • NewsVine
  • RawSugar
  • Reddit
  • Spurl
  • YahooMyWeb
Written by Tom in: Installing Wordpress |

171 Comments »

  • Firstly, many thanks for documenting your process. I have just written a similar custom 404 page, but slightly less elegantly than yours. One problem. There’s a textbox in the Admin panel with any rewrite rules in it. Your instructions say it should be beneath the “Update permalink structure” button, but there’s nothing.

    Is this a particular plugin/option I need to enable? I have set $use_verbose_rules = true.

    Comment | May 25, 2006
  • Michael Walsh

    This doesn’t seem to be working for me, I can’t see a textarea box with all of the ReWriteRules? I’m runnning WordPress 2.0.2

    I’m setting this up in a subdirectory if that makes any difference, so it’s http://www.example.com/blog/

    Comment | May 25, 2006
  • Tom

    I ran into the same thing when I was trying to install it on WordPress 2.0.2. In this new version, it doesn’t show the ReWrite rules when you have the “Common Options” set to anything but “Custom”. Select “Custom”, enter in a permalink structure and it the box with the rules in it should show up.

    Mine is:

    /archives/%year%/%monthnum%/%day%/%postname%/

    Comment | May 25, 2006
  • Tom

    The sub directory may make a difference. I haven’t tested it out in that situation yet. You may have to modify the rewrite rules to add your sub directory in front of them like so:

    Before:

    RewriteRule ^archives/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^archives/author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^archives/author/([^/]+)/?$ /index.php?author_name=$1 [QSA,L]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]

    After

    RewriteRule ^yoursubdirectory/archives/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ yoursubdirectory/index.php?author_name=$1&feed=$2 [QSA,L]

    RewriteRule ^yoursubdirectory/archives/author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^archives/author/([^/]+)/?$ yoursubdirectory/index.php?author_name=$1 [QSA,L]

    Comment | May 25, 2006
  • Cool, it’s working. Ish.

    To get the rewrite rules up, I had to edit the “Blog address (URI)” and add a subdirectory, e.g. “myblog.com” to “myblog.com/test/”. The box then showed up on the Permalinks page. I then did a find/replace, removing all “/test” strings, and put my “Blog address (URI)” back to the original URL.

    It all seems to be working except for actually viewing a post itself. For example, my permalist structure is:

    /%year%/%monthnum%/%postname%/

    When viewing a post page itself, a quick debug of the 404 handler shows the following string for the URL variable:

    /index.php?year=[yyy]&monthnum=[mm][post-title]

    i.e. the post title and month are concatenated.

    I’m trying to decipher the list of rewrite rules, but finding it difficult to debug.

    Comment | May 25, 2006
  • Tom

    Can you give me an example of a ReWrite rule you are using?

    Comment | May 25, 2006
  • Sure. I *think* this might be the offending rule. Taken straight from the WP output.

    RewriteRule ^([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2 [QSA,L]

    Comment | May 25, 2006
  • Tom

    The rule you gave me is missing the “PostName” variable. Originally, I was figuring we wouldn’t have to decipher regular expressions to get it working.

    From your previous post, it looks like it’s missing this string here: &name=[post-title].

    You wrote that it is resolving to: /index.php?year=[yyy]&monthnum=[mm][post-title]

    I would try starting over (rather than trying to debug the regular expressions). Just try changing the permalink structure (make sure it’s set to custom), and re uploading the htaccess.txt.

    Comment | May 25, 2006
  • Yep, it’s missing name=[title] but I can’t for life of me see why that rule isn’t being written by WP, especially when it’s in my permalink structure. Never mind, it’s not too tricky to modify the expressions manually to include this.

    I shouldn’t be wasting time on this at the moment (Uni finals tomorrow!) so will revisit this discussion in a few weeks when I have more time.

    Once again, thanks for the well thought out script, and taking the time to help :)

    Comment | May 25, 2006
  • Tom

    No problem. Best of luck on the finals.

    Comment | May 25, 2006
  • I tried installing it, and it didn’t work. I am running on a Linux server so I don’t know if that had and effect. If you can help me fix this problem I would greatly appreciate it.

    Comment | June 5, 2006
  • [...] s idea over at Keyboard Face.
    This entry was [...]

    Pingback | June 6, 2006
  • [...] heavily customised version of Tom’s idea over at Keyboard Face. [...]

    Pingback | June 7, 2006
  • Tom

    Oman – The modification was designed for use on a Windows server. IIS (Internet Information Services) is Microsoft’s web server software. It also relies on ASP, a programming language specific to Windows.

    With Linux, you shouldn’t even need this though. You should be able to just copy/paste the rewrite rules into your .htaccess file and it should work.

    Comment | June 7, 2006
  • Larry

    Started getting WP setup and customized late last week on IIS 5. So far, I’m happy with my progress. I stumbled upon your site while trying to figure out my 404 issues. WP is installed on the root of my site.

    When trying to test my 404 it seems as though I’m being redirected to WP’s index.php.

    Any thoughts or suggestions?

    Comment | June 14, 2006
  • Tom

    Larry – What do you mean by testing your 404?

    Are you trying to set up a custom error page in addition to this solution? If so, you need to edit a variable in the file errorpage.asp.

    At the very top of the file it says:


    Actual404 = "/"

    You would change that to be whatever your real 404 page is – for instance, you could have it redirect to “/404Error.html”

    Comment | June 15, 2006
  • Chad

    I’m pretty new to this stuff, and I’m having some trouble with this little redirect bugger. I have followed your instructions but I’m still getting a page that says “The system cannot find the file specified.

    The only way my permalink structure works right is when I’m set to: /blog/?p=123.

    Comment | June 19, 2006
  • Hi,
    Great solution! Many many thanks for developing it!
    I’ve just installed the iis rewrite and it seems to work fine with one exception.

    If you go to my site and click the “quick sketches” category, as expected you’ll see the pretty permalink in the url:

    http://www.idleminutes.com/archives/category/quick-sketches/

    However, if you then scroll down to the end of the last post and click the “older posts” navigation link, the URL changes as follows:

    http://www.idleminutes.com/index.php?category_name=quick-sketches/&paged=2

    Is that the correct behavior?

    Each individual post’s permalink is still a pretty permalink. I’m just wondering if the URL should be as well.

    Thanks!

    Comment | June 22, 2006
  • Tom

    First off, I thought I should note that Chad figured out the problem with his script – it had to do with where php was installed on the system. The system cannot find the file specified is a php error, not a wordpress error.

    Secondly, Don – Thanks for pointing that out. It does the same thing on my blog unfortunately. I think it has to do with the way the script gets the information to display (it actually acts like a web browser, fetches the page using the index.php?category_name=…, and then displays it under the permalink structure).

    This is just me guessing, but I think that because we get the page that way, wordpress thinks we’re not using ther permalink structure and would therefore like our links to be the standard.

    You may be able to change this by editing your template, but I can’t help you much there.

    So I guess the short answer to your questions is – sorry! :(

    If you figure out a solution let me know and I’ll include it in the script.

    Comment | June 22, 2006
  • Don

    Thanks Tom,
    When you say I might be able to edit my template, what part of the template would I would investigate?

    Comment | June 22, 2006
  • Don

    Tom,
    One other thing, if you click any archive post, rather than categories, you’ll get a horizontal nav link at the top of the post.
    Those nav links display the proper URL (rewritten).
    Any insight on why that works and the other ones don’t?

    Comment | June 22, 2006
  • Tom

    I looked at my own template and this is what I found in archive.php:


    <div class="navigation">
    <div class="alignleft"><?php posts_nav_link('','','&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div>
    </div>

    That led me to think that, although you could fix it in the template area, you may want to fix it in the function itself. The posts_nav_link() function is located in wp-includes/template-functions-links.php.

    I don’t have the time at the moment to go through it fully myself, but if you find anything, let me know.

    Thanks!
    Tom

    Comment | June 22, 2006
  • Tom

    I think that has to do with the function I mentioned. It may be that the different pages you are referring to are using different functions for their nav_links, though. Take a look at the template-functions-links.php, it may give you some insight.

    Comment | June 22, 2006
  • The instructions in your “WordPress Permalinks in IIS” are great, but I’m just trying to figure out how to apply them to the control panel at my hosting site. The only thing that comes close is an option to Redirect URL, with the following options (_____________ indicates a text box for me to fill in):

    1. Redirect from http://www.example.com/_________________

    2. To http:// or ftp:// or https:// _________________

    3. The client will be sent to (select one from below):
    - The exact URL entered above
    - A directory below this one
    - A permanent redirection for this resource

    Any thoughts on what I fill in for 1 and 2, and which option I select for 3?

    Any assistance would be greatly appreciated :)

    Comment | June 27, 2006
  • Tom

    Hey Darryl,

    First off, I took a look at your blog – You’ve got a great design there. Nice use of AJAX too.

    As far as your question goes, I don’t think you’re in the right place. You want access to a “Custom 404 Error Page”. The panel you described has to do with redirecting to another site or URL on your site.

    Contact your host and see if they support custom error pages. They should be able to. If they don’t have it in their control panel, you can call them and give them the instructions to set the custom 404 error page to “/errorpage.asp” and make sure it’s set to URL, not FILE.

    Comment | June 27, 2006
  • Tom,
    Thanks for that. You’re right – I was very much looking in the wrong place. There’s an option in the Control Panel for “Error”. I went in there, set the 404 page to be redirected to /errorpage.asp, and everything worked beautifully.

    It was such a relief. I have been trying so many things over the past couple of days, and this is the only spot I found this particular solution of yours. You’re a champ, Tom!

    Comment | June 28, 2006
  • @Darryl – it sounds like you have the same control panel as me. I’ve been unable to get it working, you say you set 404to be redirected to /errorpage.asp – my hosting doesnt allow me to do that as it seems to not like the “/” – it allows me to use just “errorpage.asp” – but I just a standard 404 type message when I click on my permalinks.

    Any ideas?

    Comment | July 7, 2006
  • Sorry thought I better clarify things a bit in relation to my last post….

    I get “HTTP/1.1 404 Object not found” when clicking my permalinks. But what i notice is that regardless of the url given for the errorpage.asp I always get this. I’ve even tried setting my index.php as the 404 page but always get this problem.

    Any ideas?

    Comment | July 7, 2006
  • When I enable this it works as advertised, but it substitutes ? for spaces throughout the text of my entries. If I go back to a default permalink structure, the ?’s go away. Any thoughts on why this would happen?

    Comment | July 10, 2006
  • Tom

    Dave -

    I looked at another site that I have this solution installed on and I found that it was doing the same thing as yours (putting ?s in for spaces)

    It has to do with the Charset the browser is using to interpret the page. That setting is being wiped out in the transition.

    We can, however, set it manually within the page itself. In errorpage.asp add the following line:

    Response.Charset = "ISO-8859-1"

    This should be entered right before these two lines:

    Response.Write ReturnPage(Path)
    Response.End()

    This fixed it for me. I am debating whether to put it in the original download. My thought is that not everyone will be using that Charset.

    Comment | July 11, 2006
  • Works great! The only hickup I had was that I had a htm 404 page before and this was cached in my browser which seemed all wasnt working. A CTRL+F5 fixed the issue :)

    Nice work!

    Comment | July 13, 2006
  • modernape

    Hiya,

    I installed errorpage.asp and htacess.php, on the same directory that wp is on, a windows server, but I get this error message in my browser window when I click on a permalink, even though it looks fine in the status bar. -

    Microsoft VBScript runtime error ’800a139d’

    Invalid range in character set

    /alcohol-drugs/errorpage.asp, line 84 ”

    I’ve set up the 404 redirect as per instructions too, so I’m not sure what else to do?

    Thanks very much for your help
    Modernape :)

    Comment | July 13, 2006
  • Tom

    Modernape – what is your site?

    Comment | July 13, 2006
  • modernape

    Hi Tom, my site is -
    http://www.brighteyecounselling.co.uk/alcohol-drugs/

    (the alcohol-drugs directory is WP), but as it wasn’t working I’ve reset the 404 page and the WP permalink format back to normal!
    Any ideas what was wrong? Or do I need to set it all up again?

    Thanks

    Comment | July 15, 2006
  • Tom

    I’m not sure – what was your permalink structure?

    Comment | July 15, 2006
  • modernape

    I had permalinks exactly as you suggested.

    Comment | July 16, 2006
  • I’ve made the changes and everything is working… except for the actual archive page. The form for the comments is not displayed at all.

    However, if we change the permalink to something else, say, /index.php/%year%/%monthnum%/%day%/%postname%/ — then the comments form does appear.

    As soon as I remove “/index.php”, again, the comments form disappears. Any idea what may be wrong?

    Comment | July 18, 2006
  • Tom

    Chris – I had a similar problem recently on this site. I didn\’t have the permalink structure of /index.php/…, but the actual post pages weren\’t working. They were directing to archive pages – for instance the following link would point to the archive page for May 21st.

    http://www.keyboardface.com/archives/2006/05/21/wordpress-permalinks-in-iis-without-the-mod_rewrite/

    It was, in effect, ignoring the last part of the url. This was because of the order the script parsed the rules. I put out a new version of the script as of a couple of weeks ago. You may try getting the most recent version of errorpage.asp.

    If you have the most recent version, I\’m not sure what to say. Maybe, try and take the index.php out of the permalink structure?

    If you\’re determined to keep the index.php in the structure, you can try this other solution:

    http://blog.taragana.com/index.php/archive/wordpress-tip-on-permalink-options/

    Comment | July 18, 2006
  • FA

    I’ve been trying to get this solution to work as it seems perfect. However, after following the instructions, all I get is a hung site. The home page loads, but articles don’t regardless of what permalink structure I choose. The browser just sits there with the status indicator spinning at the top-right. Accessing htaccess.php directly also hangs.

    Any ideas?

    Comment | July 25, 2006
  • Tom

    It would seem that the problem is coming from htaccess.php then. You can try switching it from using htaccess.php to htaccess.txt. Look at the very last section of the instructions page, it should help.

    Comment | July 25, 2006
  • FA

    Tom,

    I tried switching to htaccess.txt and that didn’t work. However, I did find some info that fixed my problem. I needed to create a php.ini file and included these lines:

    cgi.fix_pathinfo = 1
    cgi.force_redirect = 0

    My PHP skills are a little weak so I don’t know exactly what the above does, but it came from the WordPress Codex and it works. I now have rewrites working.

    My next problem is now when a user posts comments, they are always directed to the home page rather than to the post they replied to. I’m pretty sure this has to do with the threaded comments or subscribe to comments plug-ins I use.

    Comment | July 25, 2006
  • I have followed your instructions to the letter and get this message on every page but the home page: The system cannot find the file specified.

    Everything is in the root folder and I have added the php.ini file as instructed. Not sure what else to try.

    Comment | July 27, 2006
  • Tom

    Shell –

    It most likely is one of two things:

    1. php.ini is located in the wrong place.

    2. there is something wrong with the regular expressions in htaccess.php or htaccess.txt. To debug it, I’d set the script to use htaccess.txt and then play around with the regular expressions to see which ones it was using.

    Comment | July 28, 2006
  • Hi Tom,
    i tried a lot but it doesnt work. When i use the php.ini file all works fine with the /index.php in the url but without /index.php it will not works. what could it be? something i have write down to the htaccess files?

    thanks a lot.

    Stefan

    Comment | July 31, 2006
  • Tom

    Thanks to Stefan. He pointed out a good alternative to the solution posted here. Here it is:

    http://www.simmonsconsulting.com/wordpress/?p=204

    you only have to create a new file, for example: wp-iis.php and put following in

    < ?php
    $my_wp_url = "http://" . $_SERVER['SERVER_NAME'] . "/wordpress";
    $_SERVER['REQUEST_URI'] = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], $my_wp_url)+strlen($my_wp_url));
    $_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
    include('index.php');
    ?>

    save the file in your wordpress directory and open your iis-center. and take a change in the domain where your wp installation at.

    Comment | August 1, 2006
  • Works great – thanks!

    Comment | August 3, 2006
  • Julio

    I’m having troubles with international characters.
    Here is an example:
    http://www.juliozuniga.com/blog/archives/2006/08/07/hola-mundo/
    What can i do?
    Thanks in advance

    Comment | August 10, 2006
  • Tom

    Julio -
    It has to do with the character set the ASP page sends to the browser. You can try changing the character set to be: “ISO-8859-1″. If that doesn’t work, try other character sets until you get the result you’re looking for. Here’s how to do it:

    In errorpage.asp add the following line:

    Response.Charset = "ISO-8859-1"

    This should be entered right before these two lines:


    Response.Write ReturnPage(Path)
    Response.End()

    Comment | August 11, 2006
  • I’m working on a site for a client, that is installed on an IIS server.

    I installed errorpage.asp and htaccess.php into my wordpress folder, and changed the setting for the 404 page for my server to wp/errorpage.asp .

    I set my permalinks to /%postname%/ and didn’t set any permaliniking rules for a “category base”.

    Unfortunately, when I try to click on or enter a permalink, rather than going to the page I’ve chosen, my browser pops up a screen telling me I’m trying to access a binary file and asking me what I want to do with it. (there are no auto-generated permalinks on the front page of the site, but if you click on any of the links at the top of the screen, and then click on any of the sidebar links on any of those inside pages, you’ll see the behavior I’m talking about).

    I tried replacing htaccess.php with htaccess.txt, which did not change the situation.

    I also tried several different custom and standard permalink options, all to no avail — the problem stays the same each time.

    Any advice? Thanks very much!

    -Sara

    Comment | August 16, 2006
  • First let me thank you for the great tip, I really like it, Now i am facing 2 problems and I’d really apreciate your help

    Please open http://www.adidap.com and http://www.adidap.com/page/2 in 2 different browser sesssions
    1) The © in main page is looking well, in page 2 it is showing as a ? (this was solved by adding Response.Charset = “ISO-8859-1″
    2) The layout in page 2 is shifted :( the sidebar is not at its correct place

    thanks

    Comment | August 17, 2006
  • Thanks for the great tip, I am having a problem
    please try to open http://www.adidap.com and http://www.adidap.com/page/2 and notice how the sidebar is shifted down

    Thanks

    Comment | August 17, 2006
  • Antoine Khater

    When I am using this, even when I am logged on, I can only see the “admin website” link if i am on the root page, in all other pages, it is replaced by the “login” botton

    Comment | August 17, 2006
  • I am really sorry for the multiple posts :( I kept on refreshig the page but they didn’t show up

    Comment | August 17, 2006
  • Hello! First, thank you for providing this. I’m sure it’ll help with the search engines.

    I have one minor problem. After installing, I noticed the links on the right hand side are bold (sometimes).

    It seems to happen 100% of the time with the default/main page and on some of the pages that show up when I click a tag.

    What’s the first thing I need to do to solve this?

    Thank you. =)

    Comment | August 18, 2006
  • A great workaround, but took time to get working. I was installing WordPress 2.0.4 on a hosted Windows 2000 server, and followed all the installation steps as you give. But normal 404 error page kept reappearing, even though I had entered hoster control panel and configured the custom error message to errorpage.asp, and it confirmed the change. So I contacted the hoster, said the custom error wasn’t working – they then switched on.

    So my point is: even if you think the host control panel confirms the custom error page, you may have to ask them to implement it before it works.

    Otherwise – great solution to the problem!

    Comment | August 20, 2006
  • Hi, great little hack you got going here. One problem, not quite sure what to do with it. I got the script working great, but the theme I have selected only applies to the root index. If I go to one of the sub pages/categories it uses the original wordpress theme. Is there anyway to combat this besides placing the new theme into the original wordpress directory? You can see what I’m talking about at http://www.bluesdragon.com/blog/. Any help would be appreciated. Thanks.

    Zach

    Comment | September 4, 2006
  • Tom

    I’m not sure what you are talking about in terms of the themes, but it appears that there is something weird with the way the script is interpreting your permalink structure. It looks like it is directing all requests to return the home page, not the individual post pages or the archives.

    Have you tried it without the permalinks to make sure it works that way?

    Have you tried a different permalink structure?

    Comment | September 4, 2006
  • Yeah, nevermind about the themes. Something funky was going on there. I have the Dynamic = False , and that way the urls work right but don’t point to the right pages (like you said. If it’s set to True it doesn’t work, it just redirects to the blog’s homepage. Have any suggestions on what I can try to fix it?

    Comment | September 4, 2006
  • Tom

    Zach,

    Sorry for not responding sooner – I hadn’t noticed you replied when you did.

    When you set it to Dynamic = False, did you also upload the htaccess.txt?

    Comment | September 6, 2006
  • Hi,
    On http://blog.a1teamusatv.com I’m getting this error:
    msxml3.dll error ’800c0005′
    The system cannot locate the resource specified.
    /errorpage.asp, line 141

    I read that might be cause of the server – MSXML version or something about firewall but I’m not sure. Can you indicate me any possible solution?

    Thanks in advance.

    Comment | September 7, 2006
  • Tom

    Vialuna,

    I’m not sure what would be causing that. You can check to make sure that it is asking for the correct page by inserting this line


    response.write (SiteName & URL)
    response.end()

    This should be entered right above these lines:


    If Left(URL, 1) = "/" Then
    xml.Open "GET", "http://" & SiteName & URL, False

    If that shows you an empty string then you know it’s occurring because of that. If it gives you anything else, there is something wrong with your firewall or xmlhttp version.

    Comment | September 7, 2006
  • I put those lines and now shows: domain.com/htaccess.php
    you can check http://blog.a1teamusatv.com/ clicking on that 1st post.

    Where do you think could be the problem?

    Thanks for your help.

    Comment | September 8, 2006
  • Tom

    Thanks, the problem isn’t with the rules then. It’s a problem with the way the XMLHTTP object or a firewall on the server.

    Unfortunately, I don’t have any good advice on how to fix either of those problems. The one last thing you can try (I’m not very hopefull of it working though) is to Find/Replace all instances of “Microsoft.XMLHTTP” to “MSXML2.ServerXMLHTTP”.

    Comment | September 8, 2006
  • Hello!

    I’m trying to install your solution in my WordPress blog but i can’t do run it!!

    My blog is: http://blog.jatubio.com
    I will had configured permalinks in wordpress same of you:

    I will have trying to use ‘Dynamic Rules’ but htaccess.php do not’t return any text.

    For ‘Static Rules’ i will have removed the first and last lines of htaccess.txt: “” and “” and it’s works ok.

    Any idea for work with Dynamic??

    Thanks you in advance.

    And many thanks for this great works!!

    Comment | October 7, 2006
  • Tom

    Hi Jatubio,

    I took a look at your htaccess.php file on your server. It gave me this error:

    Fatal error: Call to undefined function: mod_rewrite_rules()

    mod_rewrite_rules() is supposed to be wordpress’ built in function that returns the rules. Rather than try and debug why that’s not working, you can just get the appropriate rules by going in to wordpress’ admin section under permalinks it says something like this:

    “If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.”

    Copy and paste the entire thing into your htaccess.txt and set the script to static rather than dynamic. That may work. Otherwise, you might want to try a different workaround.

    Best,
    Tom

    Comment | October 9, 2006
  • Hi all,

    Forst of all thanks for the script!

    I kept on getting this error:

    Microsoft VBScript runtime error '800a0005'
    Invalid procedure call or argument: 'Left'
    /errorpage.asp, line 179

    After debugging I found out that the variable Start needed to be initialised to 1 in the function AddCredits:

    Function AddCredits(PageHTML)
    Start=1

    Now it works as a charm. Thanks!

    Comment | October 12, 2006
  • Tom

    Thanks! I’ve added that line to the main download.

    Comment | October 12, 2006
  • Domokos

    Hi All,

    I have problem with the solution. I installed and configured everything as described. However if I click on a page or post I always get the front page. You can check my temporary site at http://madfie.hu.anaxanet.com/.

    Do you have any idea what can be the solution?

    Thanks in advance,
    Domokos

    Comment | October 17, 2006
  • Tom

    Hi Domokos,

    Generally, what that means is that the rules that are in the htaccess.txt or htaccess.php file are not correct. Are you using htaccess.php or htaccess.txt (static or dynamic?).

    If you reupload htaccess.php I might be able to help.

    Best,
    Tom

    Comment | October 17, 2006
  • Hi,Tom

    I tried you solutions, Thank you very much ,but I meet 2 problem.

    1: my web site is in Chinese, double-byte, and if use your solution, the Chinese text will change to ????????, question marks.I tried to add

    Response . Charset = “UTF-8″ or “GB2312″ or other charset,

    but it dosen’t work.

    2.I use your static soluton now, because dynamic solution seems fail.
    but, now, I must access my site with http://learning.artech.cn/index.php, can not omitt the “/index.php”

    Could you tell me how to resolve the two problems?

    Thank you very much!

    (Now, i have uninstalled the solution for normal access)

    Comment | October 26, 2006
  • Tom

    Hi Chance,

    Thanks for letting me know about these problems. I haven’t tried it out with Chinese characters before. I looked up what the Charset should be for Chinese and it is: big5.

    Here’s the link I used to find that out:
    http://a4esl.org/c/charset.html

    So, in your code use:
    Response.Charset = "big5"

    I’m glad you figured out how to use the static solution. I have a feeling (I haven’t tried this out yet) that the dynamic permalink rules might not work with the latest release of WordPress (2.0.4). If anyone knows for sure, please let me know.

    What happens when you omit the “/index.php”?

    Thanks,

    Tom

    Comment | October 26, 2006
  • thank you for your reply!

    for 1st question:

    The “big5″ is another Chinese charset, which is used in Taiwan, “gb2312″ is used in mainland of China.

    but both of them fail, all Chinese text was replaced by question marks as ????????.

    The home page “index.php” is correct, but all other linked pages can not dislpay Chinese Text

    for 2nd question:
    if directly access http://learning.artech.cn, the web page is blank, there is not any thing in it. if access http://learning.artech.cn/index.php ,the home page is OK!

    I am using the 2.0.4 version. is this cause the problem?

    thank you very much!

    Chance

    Comment | October 27, 2006
  • hi,Tom!

    I have almost resolve the problem.

    Now, everything seems good except that the statice “Pages” can not be correctly linked.

    Just like your blog, the page “About me” links to “http://www.keyboardface.com/about/” , but in my blog it redirect to 404page. I guess i must add some rules in htaccess.txt?

    Thank you very much!

    Chance

    Comment | October 27, 2006
  • chance

    hi, Tom.

    This my third reply to you !

    I must tell you the good news! I have make it OK!

    about the Chinese text, I add a line at the beginning of errorpage.asp, it’s OK!

    and about the “Pages”, I find the secret of (about) and (iis_ermalink) in htaccess.txt, I replace them with my own strings, it’s OK!

    thank you very much! I’m very happy!

    there is the last question, to you mind, do you think this operation will lower the response speed of this web pages?

    than you!

    Comment | October 27, 2006
  • Tom

    Hi Chance,

    That’s great to hear that you got it working! What was the line that you added to the beginning of the page that made it work with Chinese?

    As far as the lower response speed of the web pages. It might slow it a tiny bit because it has to initiate a separate HTTP request for the page rather than just rewriting the URL. Here’s the post that goes over the idea.

    Thanks!
    Tom

    Comment | October 27, 2006
  • How did Chad fix the php error, The system cannot find the file specified error, he was having? I am having the same error and I just can’t find the fix. I have setup a virtual directory for my blog on my dedicated Windows 2003 Server. Thanks for any help you can give me.

    Comment | October 27, 2006
  • Hi Tom,

    I have the same problem as Domokos (17/10/06). I tried Dynamic (htaccess.php) and was only able to return the home page, I changed errorpage.asp to False to use htaccess.txt and receive the same error. My control panel is Helm. For custom error pages I can only edit the page location of the file, I can’t select whether it is a file, URL or default. My error page location is /errorpage.asp I’m clueless.

    Gary

    Comment | October 27, 2006
  • Hi, Tom,

    the line at the beginning of error page I mentioned above is “[%@codepage=936%],
    yesterday the code was removed in my post. so I use [] replace .

    Thank you very much!

    Comment | October 27, 2006
  • hello Tom,

    Here I have a new problem to ask for help to you!

    I use a tag(keyword) plugin of wordpress, so I added a new line in htacess.txt as :

    RewriteRule ^tag/(.+)/?$ /index.php?tag=$1 [QSA,L]

    if the tag is english , it works well.

    but the problem is that if the tag is Chinese it will be convert to UTF-8 then the URL is like http://…../tag/%E5%BD%A2 ,then it can not find the post.

    but I tried http://…../?tag=%E5%BD%A2 , it’s OK.

    that is to say the course of converting is not correct for the string “%E5%BD%A2″?

    I don’t know what’s the reason ,and how to make my tags support Chinese.

    maybe the new rewrite rule I added is wrong?

    thank you very much!

    Comment | November 1, 2006
  • Tom

    Hi all,

    Sorry for the delay in replying to your comments. It’s been a busy week over here.

    First off, Jared, Chad’s problem was that his php.ini file was in the wrong folder. The system cannot find the file specified error, is a generic php error and can be caused by any number of errors, though.

    Gary, I think there is something with WordPress 2.0.4 where it’s not giving the correct rewrite rules to the plugin. I have yet to test this. You can try using htaccess.txt instead of htaccess.php.

    Chance, try this rule:

    ^tag/([^/]+)/?$ /index.php?tag=$1 [QSA,L]

    Let me know if it works.

    Thanks,
    Tom

    Comment | November 2, 2006
  • Tom,

    I created a “php.ini” file with the following content:
    cgi.fix_pathinfo = 1
    cgi.force_redirect = 0

    Uploaded the file to the root of my blog and now have permalinks working.

    Is there any method of removing the “index.php” in the permalinks output?

    Gary

    Comment | November 2, 2006
  • Tom

    I’m glad you got the php.ini file working. This solution should be giving you permalinks without the /index.php/categoryname…/ structure. I suspect you may be using a different solution if you have that structure.

    If you are using this solution, then you should be able to change your permalink structure within wordpress and it will just work.

    One tip for you. I took a look at your blog and it takes a really long time to load. The reason is you have the Google Maps code included on all of the pages of your blog, not just the ones that have Google Maps on them. You should be able to add the appropriate code, just on the select pages that need them.

    Best,

    Tom

    Comment | November 2, 2006
  • I modified the htaccess.txt according to your code, but the result is same as what I described before. it only works to english tags, but not to unicoded tags,such as “%E5%BD%A2″.

    I don’t what is key reason of this problem.

    Thank you very much!

    Chance

    Comment | November 2, 2006
  • chance

    Hi, Tom,

    I found there is really a problem.

    If the request includes non-english encoded text, including querystring and form, it can not transfer to the errorpage.asp.

    I did a test, that I added a line to directly write the querystring at the beginning of errorpage.asp, I found the querystring had been changed. the non-engish words had been replaced by “?”.

    I guess because IIS get the request, and find that the page dose not exist, so redirect to the errorpage.asp, but in the course, querystring has been decoded as default codepage, so that non-english text will be translated into “?”, and then errorpage.asp can not do rightly.

    So, could you have some good way to make IIS totally “copy” querystring to errorpage.asp, so that errorpage.asp can decoded the request according to the correct codepage.

    thank you!

    Comment | November 11, 2006
  • Hi Tom, I am still experiencing difficulties on my site.

    I still can not get this to work without including “index.php” as part of the permalink. I have tries both the “php” and “txt” options without success. I am using the default files from the download.

    I am also experiencing a problem with the navigation links with “category.php”. Page 1 displays correctly, but if there are more than 5 posts in a category, Page 2 displays the second page of ALL posts, not just the posts of the current category.

    I suspect this problem has something to do with the first problem as it is obviously using “index.php” instead of “category.php” to retrieve the post excerpts.

    I know the google maps plugin is a bit cumbersome, but I would like to get these issues resolved before moving on to that one.

    Any chance you could take a further look.

    Thanks in anticipation.

    Gary

    Comment | November 12, 2006
  • Hi Tom,

    Finally got it all working!

    Regards

    Gary

    Comment | November 13, 2006
  • Henry

    Dear Tom,
    Thank you for the very innovative approach to the IIS url rewrite problem.
    I am actually using WordPress Multi-user, mu.wordpress.org

    Your solution works with main user, however, when trying to access other newly created blogs, the parserules can’t find any matching file.
    http:/127.0.0.1/wpmu/blog/2006/11/ -works ok
    http:/127.0.0.1/wpmu/newblog/ -error

    Any advice?

    w

    Comment | November 14, 2006
  • Tom

    Hi Gary,

    Thanks for letting me know! I’m sorry I wasn’t able to respond to you sooner. I’m glad it’s working.

    What was the key?

    Thanks!
    Tom

    Comment | November 14, 2006
  • Tom

    Henry,

    I’ve never tried it with the new multi user edition. I imagine you’ll need to edit the htaccess.txt file to work for different blogs. Sorry – I just have no experience with that edition.

    Let me know if you get it working.

    Thanks!
    Tom

    Comment | November 14, 2006
  • Ron

    Hi Tom

    Have installed your script but my links are just redirecting back to home page what do i do?

    I know i read it somewhere but have tried so many things i am lost?

    Ron

    Comment | December 13, 2006
  • Ron

    Further to my request I am hosting on a Windows server using IIS 6.0

    My configuration is exactly the same as per your instructions which creates the folder i was after but still redirects to the home page. Im using errorpage.asp and htaccess.php I have also tried htaccess.text with false in the errorpage with the same result.

    Comment | December 13, 2006
  • Tom

    Hi Ron,

    I took a look at your site, and it looks like you have a problem with the htaccess.php. Try accessing htaccess.php in a browser:

    http://babyshowergifts.babyshowermoments.com/htaccess.php

    The script will redirect to the home page if it can’t find any rules that match. You can change that by changing the variable: Actual404 (at the top of the script).

    Currently your htaccess.php gives an error, so it doesn’t have any rules to work off of. Fix the htaccess.php and the rest will work.

    Best,
    Tom

    Comment | December 13, 2006
  • Ron

    Hi Tom

    Can you please consider me a dummy, do i change the errorpage.asp file where it has actual=”/” and if so what do I change it to?

    Or are you asking me to add a link into the htaccess.php file

    Ron

    Comment | December 13, 2006
  • Tom,

    I just migrated to IIS yesterday, after two years on Apache. Let me start off by thanking you for the work you’ve done ahead of all of us and then letting us know how you got your permalinks working in IIS.

    My problem at the moment, I believe is because I’ve not been able to set my 404 type to URL explicitly…would that cause me to get an error such as “The request is not supported.”?

    My ISP is using Helm 3.x, so it might be a limitation there and I need to contact them. But if the problem, at this point, is not related to the error handling type…then I should probably cross one bridge at a time.

    Thanks!

    Comment | December 15, 2006
  • Tom

    David,

    It looks like the error you are getting currently is:

    “The system cannot find the file specified.”

    That would seem to indicate to me that you are specifying a 404 error page that doesn’t exist. You need to set the 404 error to go to: /wordpresss/errorpage.asp

    Be sure to set it to type: URL

    Best,
    Tom

    Comment | December 15, 2006
  • Tom

    Ron,

    Sorry for the confusion. The problem is with your htaccess.php. No need to change the Actual404 variable. I was just mentioning it so you knew what it did.

    There is something wrong with your htaccess.php. It should spit out something that looks like this: http://www.keyboardface.com/htaccess.txt.

    I would try this:

    1. In errorpage.asp change this line:

    Dynamic = True
    to
    Dynamic = False

    2. Then make sure you have a copy of htaccess.txt uploaded to the server.

    3. Make sure your permalink structure is set up with this pattern:

    /archives/%year%/%monthnum%/%day%/%postname%/

    Hopefully that will get you around whatever error you’re having.

    Best,
    Tom

    Comment | December 15, 2006
  • Tom,

    Turns out my original problem was that ASP was not enabled on my server. After figuring that bonehead move out I’m now in the same situation as Ron I believe. I am using the same permalink structure as you (and as is mentioned in your comment above to Ron). I changed Dynamic to False and updated the htaccess.txt file to contain the same info that you linked too.

    However, I’m still ended up at my actual 404 page when trying to access a permalink.

    I have the htaccess.txt file in both my root directory and my wordpress directory, and that doesn’t seem to make a difference.

    Again, thanks in advance for your help.

    Comment | December 15, 2006
  • Ron

    Hi Tom,

    My site now just redirects back to the home page all my page links on the right hand side show the pages in a folder but my top bar nav still shows page?=15 so i have now both types of links on my site..

    Comment | December 15, 2006
  • Sorry if this double posts, got an error a bit ago when trying to submit this….

    I think I may be on to something….and this might be a problem with IIS not set up to do the URL type forwarding. I set up a test error page with some PHP….if your ASP file ending up hitting what it deemed a ‘real 404′ then I forwarded to my Php script.

    To do this I modified your ASP slightly so that the Actual404 looked like this….

    Actual404 = “/testerror.php?url=” + Request.ServerVariables(“SCRIPT_NAME”)

    Then, in the PHP I just diplayed whatever the URL parameter is. My ASP/vbscripting is pretty poor, so I may be looking at the wrong variable with my script…but I always end up with “/erropage.asp” as my parameter.

    Is this the result of the way that my error page handling is set up? Or do you think its a different kind of issue.

    Comment | December 18, 2006
  • Hi, I am getting an error when clicking on the post title, “Sorry, no posts matched your criteria.”

    homepage works:
    http://www.wearchildren.com/blog

    category works: http://www.wearchildren.com/blog/category/shirts/

    post doesn’t work:
    http://www.wearchildren.com/blog/shirts/my-first-post/

    My permalink is set to:
    /%category%/%postname%/

    Link to my htaccess.php:
    http://www.wearchildren.com/blog/htaccess.php

    What am I doing wrong?

    Comment | December 29, 2006
  • bueller? bueller?

    Comment | January 2, 2007
  • Worked on ASPNix w/ WordPress v2.0.5 using htaccess.txt – dynamic did not work. I did not have to change anything in the files. Note: Using the same permalink structure as your blog.

    Comment | January 2, 2007
  • Tom

    Hi Scott,

    Sorry for not getting back to you sooner. The problem has to do with the order of the rules that are being generated. What you want to do is copy the output of your htaccess.php and paste it into a htaccess.txt. Then rearrange the rules so it goes from longest (the most strict) to shortest (the most broad).

    The problem is that there are two rules that will match. The category rule AND the post rule. The program takes the first match and reroutes it. It processes it top to bottom, so you need to put the post rule above the category and you’ll be fine.

    What’s bueller?

    Best,
    Tom

    Comment | January 3, 2007
  • “Bueller” is in reference to the teacher in Ferris Bueller’s Day Off. He repeats “bueller” waiting for the student to reply, but he isn’t there.

    I figured I would get some nepotism and you would answer me faster since I live down the street from you (well, Burbank anyway).

    My php is pretty bad, and my regexp’s even worse, but i will attempt your suggestion anyhow.

    Comment | January 3, 2007
  • Tom,

    First let me say “Cool Tool!”… plus I haven’t had a chance to dig super deep in your blog, but it looks like you’ve got a lot of interesting things to talk about. I predict I will be spending a lot of time reading your blog.

    Anyway, on to the question (thanks in advance for any help you can provide).

    1) I am trying to get your plugin to work with WordPressMU. Have you tried this yet? Any suggestions?

    2) I ran into a total dead end with WordPressMU so I decided to install WordPress and play around with getting that to work first, figuring that I’d learn the tricks on that system first, and then migrate what I learn to WPMU. I mostly have it working, but I can’t seem to get permalinks to work unless I include the “/index.php/” in the URL structure. As far as I can tell, everything seems to be working fine if I keep “index.php” in there… pages, posts, categories, etc… but when I remove that from the structure, I just get a 500 internal server error.

    By the way, I couldn’t get the htaccess.php to work unless changed:

    require_once(‘../permalinks3/wp-blog-header.php’);
    - to -
    require_once(‘./wp-blog-header.php’);

    I don’t know if that broke things… I don’t think so, because pages seem to be working so long as I include the “/index.php/” in the path.

    Anyway, sorry for the long post. Would love to get this working on WordPressMU.

    Thanks.

    -Brad

    Comment | January 4, 2007
  • OK. I spoke too soon and your solution only partially worked for me. It would not show user comments on new posts created and categories did not show properly. I am running the newest multi-user edition of WordPress. After searching for hours I found the following php solution that uses 404 redirection and works like a charm.

    http://wordpress.org/support/topic/36214

    Comment | January 5, 2007
  • Well, after playing around with this some more, I think that actually, I don’t have your tool working at all. When I thought I had it working with wordpress, it was actually just working because wordpress’s normal index.php was handling things. Hence why things broke when I tried to make the pretty URLs not have index.php in them. Any tips on how I might be able to debug this? I am tempted to go ahead and build a ASP.Net httpModule or httpHandler, and borrow your clever idea of loading the rules dynamically (since that piece of the system seems to be working).

    At least I am still convinced that I don’t need to switch to apache or use one of the commercial ISAPI plugins. (Those weren’t any easier to get working, by the way.)

    Comment | January 5, 2007
  • Eric

    I’m trying this idea . . . but every time I click on a link on my blog it just takes me to the homepage of the site my blog is hosted on. I have the blog installed in a subdirectory on my site. Is that why this is happening? For instance, I click on an archive date, and boom! I’m at the homepage of the site (not the blog). I go back to the blog, click on “about” and boom! I’m at the homepage of the site again. Every link takes me back to the homepage. Anyway, obviously I don’t know much but I’m just trying to figure out a way to get the “pretty permalinks” to work on IIS 6. Thanks again.

    Comment | January 5, 2007
  • Eric

    Can’t get it to work. It always redirects to the index page of my site.

    My blog is in a subdirectory of my main site. Could that be causing the problems?

    Right now, any link I click on in my blog takes me straight to the index page of my main site.

    Comment | January 5, 2007
  • eric

    I’ve done all the steps . . .
    Now every link in my blog takes me to my main site index page (my blog is located in a subdirectory of my main website).

    I tried uploading the files to my root of my main site and pointing the 404 page there . . . still the same result.

    Comment | January 5, 2007
  • Tom

    Eric – I\’m not sure how to solve your problem, but thanks to Jermaine, there might be another good solution using the 404 error page, etc.

    http://www.nathanm.com/wordpress-plugins/

    Scroll down to the \”Wordpress Remove Index.php from Permalinks in IIS Plugin\”

    It sounds like a similar solution, but it\’s PHP based, which fits in with WordPress a lot better.

    Let me know if it works!

    Tom

    Comment | January 6, 2007
  • blargh. i followed your instructions as stated. (although i have have feeling that i missed something)

    well, the 404 error page works, but i can’t seem to get the blog to get me to the correct entry using the blooming new format. even by posting a new entry…

    i used the custom formatting in the permalinks section of the option tab:
    /index.php/%year%/%monthnum%/%day%/%post_id%/

    it doesn’t like me. nobody likes me. nobody loves me either.

    Comment | January 6, 2007
  • Eric

    I’m sorry I posted three times above. I didn’t see my post at first so I re-posted, then I didn’t see the post again, so I posted using IE, and then . . . well, anyway, sorry.

    I tried the alternate link you gave me and it WORKS! I’ve been getting so frustrated trying so many different things, but this is really cool. It works! It works! It works! It works! Yippee!

    You are the best. I appreciate your help. I have a serious problem staying up to late and being overly obsessive/compulsive about such things until they’re solved.

    Thank you again and again!

    Comment | January 7, 2007
  • [...] Artigo original (em inglês): WordPress PermaLinks in IIS without the mod_rewrite. [...]

    Pingback | January 15, 2007
  • I have followed the instructions and now when I go to click on a page it pops a download box that says its a binary file and asks what to do with it. I have my blog here

    http://63.134.220.40/blog/. Any ideas of what I did wrong?

    thanks!!
    Shannon

    Comment | January 31, 2007
  • Tom

    Hi Shannon,

    That’s very strange. It looks like your server isn’t processing any of the ASP code. You should test it by uploading a file named test.asp. The only line you should put in the file is

    response.write("hello")

    Look at it in a browser. If it spews the code back to you, then we’ve spotted the problem.

    Best,
    Tom

    Comment | January 31, 2007
  • Hi Tom,
    Thx alot for you nice solution, I was getting a lot of grey hairs before I found this :-S

    Well finally I still have a Problem, when u visit a page on its permalink, the umlauts are still messed up with ? all over there…
    (link to show: http://blog.cosmicdreams.ch/archives/2007/02/08/permalinks/)

    I did set the encoding in as u mentioned earlier before and I tried latin encoding as well as utf, but without any changes…

    any suggestions?
    bets regards from snowy switzerland
    Jonas Rothfuchs

    Comment | February 8, 2007
  • Alex

    Thank you for this plugin! I can’t wait to get it working:)

    Am I missing something though? I can’t seem to get this working. Where am I supposed to upload htaccess.txt? Also, will this plugin redirect all old links that included /index.php/ to the new link?

    Comment | February 9, 2007
  • Hi, I had done exactly as told in the readme. I had installed my blog in the root directory. I tried to use a different theme and this is what happens. The homepage works well with the new theme but the category/static pages revert back to the default theme. What did I do wrong?

    Comment | February 11, 2007
  • Ok, found the Clue:

    There are two places where you’ll have to insert Response.Charset():

    so ther Code looks like this (around line 101 of errorpage.asp)

    Else
    If Credits = True Then
    Response.Charset = “ISO-8859-1″ Response.Write(AddCredits(ReturnPage(Path)) Response.End()
    Else
    Response.Charset = “ISO-8859-1″ Response.Write ReturnPage(Path) Response.End()
    End If
    End IF

    Comment | February 13, 2007
  • [...] Nach den anfänglichen Stolpersteinen mit dem Charset für die Permalinks läuft nun alles *uff*. Dank der Lösung von Tom konnte ich die Permalinks auch mit dem IIS benutzen und musste nur noch etwas mit den charsets kämpfen. Dafür kann ich nun etwas ASP [...]

    Pingback | February 13, 2007
  • Ron

    Hi – I cannot seem to get this to work on my hosting farm. Two Windows 2003 IIS 6 load balanced servers.

    Under permalinks in wordpress backend I have this:

    custom structure: /index.php/%year%/%monthnum%/%day%/%postname%/

    category base:
    /archives/category

    I have 404 set to URL, /errorpage.asp

    Errorpage.asp is uploaded, also htaccess.php. Htaccess.php contents are as follows:

    use_verbose_rules = true;
    echo $wp_rewrite->mod_rewrite_rules(); ?>

    With all of this enabled – when you click on the Title of a wordpress entry it just takes you back to the main page of the website. I have spent quite some time messing with this, and it is really bugging me. I would love to get it to work.

    I have the changes currently still implemented on the live website @ sysadm1n.com so please do check it out to see the behavior.

    Regards,
    Ron

    Comment | February 21, 2007
  • Ron

    In response to the above, the full contents of my htaccess.php file were not displayed in the comment for some reason.

    To see the entire contents check: http://www.sysadm1n.com/htaccess.txt

    Regards,
    Ron

    Comment | February 21, 2007
  • Lovely_angel_for_you

    Hi Tom,
    Wonderful small application. I am pretty sure it must have helped lots of people in getting their blogs up and running with permalinks. However, when I used it, it only does one thing. Bring me back to my homepage.
    Came to your support link. And started from downwards up, as thats where you find latest issues with the latest update. And just right there was a link that you suggested.
    http://www.nathanm.com/wordpress-plugins/
    Wow!!! Does that work? No it doesnt work, it makes my blog look pretty, pretty with permalinks.
    Thanks a lot.
    Regards
    Lovely

    Comment | February 28, 2007
  • Thanks for the wonderful solution!

    I finally got it to work on my IIS server. It didn’t work the first time. I think my server didn’t like Dynamic=True setting.

    When I set Dynamic=False, it works! I think I can live with the static method and configure htaccess.txt manually.

    I managed to make the URL looks just like how it appear on my other blog hosted in a Linux server i.e. /%year%/%monthnum%/%postname%/ and /category. Now I can move my blog from IIS to Linux and vice versa!

    For those who are interested, you can see my modification at
    http://www.content-goldmine.com/htaccess.txt

    Comment | March 30, 2007
  • Hi, I use your script and it’ fix many problem for my site about path but one problem that your script has is encoding. I use binary convert function from site : http://p2p.wrox.com/topic.asp?whichpage=1&TOPIC_ID=7695&#99203 to fix it and now it’s ok.
    I made some change in your script by add this function.

    Function bts(data)
    ‘Converts binary data to string
    sOut = “”
    For i = 0 to UBound(data)
    sOut = sOut & chrw(ascw(chr(ascb(midb(data,i+1,1)))))
    Next
    bts=sOut
    End Function

    and change

    ReturnPage = xml.responseText
    to
    ReturnPage = bts(xml.responseBody)

    and at last thank for your solution.

    Comment | April 5, 2007
  • Tom

    Hi Nat,

    Wow – Thanks – That’s exactly what several people have been trying to fix. I’ll be sure to add that in the next release of the script.

    Best,

    Tom

    Comment | April 5, 2007
  • [...] วันนี้นั่งà¹?à¸?้ไข WordPress เà¸?ือบทั้งวันเลย เริ่มจาà¸? ย้าย Catalog มาเป็น Tag จาà¸?นั้นà¸?็ลบ Catalog ทั้งหมดเปลี่ยนมาเหลือà¹?ค่ 4 อย่าง พอà¸?ดดูà¹?ล้ว โอ้ว โล่งขึ้นเยอะเลย ต่อจาà¸?นั้นà¸?็à¹?à¸?้ Permalinks ให้สามารถใช้ได้บน IIS6 (ถ้าเป็นบน Apache จะง่ายมาà¸?à¹?ค่มี .htaccess à¸?็เรียบร้อย) สำหรับขั้นตอนà¸?ารทำà¸?็ ตามนี้ http://codex.wordpress.org/Using_Permalinks#Structure_Tags à¹?ต่สำหรับของผมà¹?ล้ว à¹?à¸?้ตามนี้ http://www.keyboardface.com/IIS-Permalinks/ à¹?ละà¸?็à¹?à¸?้ไขเพิ่มนิดหน่อย ตาม comment ในหน้านี้ http://www.keyboardface.com/archives/2006/05/21/wordpress-permalinks-in-iis-without-the-mod_rewrite/ เพื่อให้สามารถใช้ unicode ได้ เท่านี้à¸?็เรียบร้อย [...]

    Pingback | April 5, 2007
  • hello Tom,
    thanks for this post, but unfortunately it doesn’t work for me..

    i have set permalinks custom structure to:
    /%year%/%monthnum%/%day%/%postname%/

    i have configured the 404 to /errorpage.asp and downloaded the archives fro this post.

    whenever i click on whatever link in my blog, it get’s always redirected to the homepage.

    I really don’t know what to do. Can you please help me out?

    One thin that caught my eye is the htaccess.php. The code is:

    use_verbose_rules = true;
    echo $wp_rewrite->mod_rewrite_rules(); ?>

    where does the path “../permalinks3/wp-blog-header.php” come from?? i don’t have this directory.. anyway i don’t know if that’s the problem. I’ve been braeking my head over it almost 2 days now. Rescue me.

    Comment | April 16, 2007
  • Sorry, the code came out wrong in this text-editor.

    the line i’m talking about is:
    require_once(‘../permalinks3/wp-blog-header.php’);

    My blog is http://www.sao-miguel-do-gostoso.com/

    Comment | April 16, 2007
  • Tom

    Hi Gert,

    Thanks – I think you found the problem. htaccess.php should read

    require_once("./wp-blog-header.php");

    It shouldn’t have the permalinks3 in it. That was added by my code editor and shouldn’t have. I have fixed it in the zipped file that gets downloaded, but you may want to edit it by hand and try it out.

    Thanks,

    Tom

    Comment | April 16, 2007
  • Hi Tom,
    thanks for the fast reply. I have changed the path but now it seems that the browser gets stuck. it keeps on searching for something. Check it out on http://www.sao-miguel-do-gostoso.com/
    thanks

    Comment | April 16, 2007
  • Tom

    Hi Gert,

    I checked your site out and it appears that if you try and access htaccess.php by itself, the server hangs. I bet that’s where the error is coming from. Make sure you can access htaccess.php by itself at http://www.sao-miguel-do-gostoso.com/htaccess.php and it should then work.

    Best,

    Tom

    Comment | April 16, 2007
  • ok.. easier said than done ;o)

    the server hangs indeed on htaccess.php

    what can be the reason? how can i make it work?

    (i’m not really a programmer you know, i’m just a guy who likes windsurfing..)

    Comment | April 16, 2007
  • Hi

    Thanks for the contribution, it looks like just what I’m after.

    Problem’s Im having so far are:

    - If I change structure to something like:
    /archives/%year%/%monthnum%/%postname%/

    All links redirect to the homepage, also even with the structure you suggest in the instructions it works for new posts, but old posts get a Not Found message.

    Any ideas?

    Thanks

    Comment | April 19, 2007
  • Tom

    Darren,

    If all links redirect to the homepage, that means that none of the rules matched and therefor it is redirecting you to the homepage.

    If it is giving you a not found message that means that it is confused by the rules. It may be that it is using the “year” to look up the “post name” or something like that.

    I hope that makes sense.

    Are you using dynamic or static rules?

    Best,
    Tom

    Comment | April 19, 2007
  • Tom,

    Thanks for the reply.

    I have tried using both ways, I will try and have a play around with the htaccess.txt file, although I’m probably shooting in the dark.

    I’d really love to be able to get your script working properly before I launch my blog.

    Cheers
    Darren

    Comment | April 20, 2007
  • Doesn’t work for me. I get a VBScrpt error:

    Microsoft VBScript runtime error ’800a0005′

    Invalid procedure call or argument: ‘Right’

    /errorpage.asp, line 25

    Not sure how to troubleshoot that.
    Thanks,
    Trevor

    Comment | April 23, 2007
  • Tom

    I believe that means that you have the 404 error page set with type “file” not type “url”

    Best,
    Tom

    Comment | April 23, 2007
  • Hello Tom,
    I tried your solution,
    but for some reason it redirects me always to the root url.
    My blog is on http://triporiginator.com/travelarticles/ – doesn’t mater what I click, it redirects me to http://triporiginator.com
    Can you please help!
    Thanks
    Milan

    Comment | April 24, 2007
  • Tom

    Hi Milan,

    The problem you are talking about actually is an error in the script itself. It’s been corrected.

    Redownload the script and upload errorpage.asp to the server and it should work now.

    Best,
    Tom

    Comment | April 25, 2007
  • Darren

    Hi Tom,

    Still no joy getting it working, same problem as Milan. Tried redownloading the script but it still aint working, just redirects to site root.

    If I click on a category, the url changes correctly but my homepage is loaded with no stylesheet or images. All other links in the blog simply redirect to homepage.

    I have tried both dynamic true and false with the exact same results.

    Any further thoughts?

    Darren

    Comment | May 3, 2007
  • Great solution, thanks for the effort.

    One problem I have is that the server seems to use a seperate session for the page it displays. So, for example, I appear logged in on the home page, but I don’t appear logged in on any of the post pages (that are going through the custom 404). Anyone has any idea how to resolve this?

    Owen

    Comment | May 18, 2007
  • Tom

    Hi Owen,

    That’s a great point. I hadn’t thought of that. I believe the 2nd session is due to the fact that ASP pretending to be another user looking at the site and then displaying what it sees to the actual user.

    I haven’t run into a problem with that because I don’t require people to be logged in to leave a comment.

    One way to work around it is to have the comment link go to the actual page: index.php?p=… On the actual page they will be logged in.

    I haven’t tried logging in on a 404 error page either, though. It could be that if you log in through a 404 error page, you’ll be logged in through the rest of them.

    You’ll have to try it.

    Best,
    Tom

    Comment | May 18, 2007
  • Brian

    I’m getting the same error as Trevor…

    Microsoft VBScript runtime error ’800a0005′

    Invalid procedure call or argument: ‘Right’

    /errorpage.asp, line 25

    Not really sure what to do about this. Any ideas?

    Comment | May 26, 2007
  • Tom

    Hi Brian,

    The reason you are getting that error is the same reason Trevor was. The solution would be the same as well.

    I believe that means that you have the 404 error page set with type “file� not type “url�.

    Best,
    Tom

    Comment | May 26, 2007
  • Couple problems:

    It does not like logged on people. For example, I log on, I click on a link that uses your code, and suddenly I am no longer logged into that page. I click on Logon, and suddenly I am logged in again.

    For some unknown reason it does not play nice with http://wordpress.org/extend/plugins/cforms/ Now that may just be the way it is setup.

    I do like what you have done though. Great work. Hint for others: If your server is behind a firewall with an internal IP only with the firewall port forwarding traffic, add the host info to that server;s hosts file, eg

    my external ip for http://www.whome.com is 99.123.11.8
    my internal ip is 192.168.1.5

    The firewall take all traffic aimed at 99.123.11.8:80 and forwards it to 192.168.1.5

    So my hosts file will look like:

    192.168.1.5 http://www.whome.com

    Comment | May 27, 2007
  • I tried your solution and it doesn’t seem to work for me. When I try to implement on my wp 2.2 blog at http://blog.greathouse.net the site never appears / responds. If I reset the permalinks setting in wp-admin back to it’s orgional default setting and the site starts responding / appearing again. http://blog.greathouse.net is a virtual directory setup under the main web site. I tried setting the Dynamic = False and that did not help.
    I am trying to use the same permalink structure you specified in your read me….
    Structure: /archives/%year%/%monthnum%/%day%/%postname%/
    Category Base: /archives/category
    I preformed no other modifications.

    Thanks
    John

    Comment | May 29, 2007
  • I’ve been working this problem for a few days with no luck. I’m trying to use Copyblogger 1.0 by Chris Pearson and he has even looked at it and doesn’t appear to be able to help. I’ve tried using your solution “Wordpress Permalinks in IIS using Custom 404 Redirect” but all that happens is nothing my browser just sits there trying to load the page and never does. I’m starting to think that it is not possible to make Permalinks work on a Windows 2003 server. I’m hosting WordPress at Blazer Network http://www.blazernetwork.com/ using a Windows 2003 server. I’m using the latest version of WordPress version 2.2.1. I’m using Blogger right now to host my blog but I would like to transition to WordPress but I would like permalinks to work before I make the switch. I have a test version of WordPress setup at http://flyballblog.i-flyball.com/ . Can anyone make any suggestions that I might be able to try? Thanks, Larry

    Comment | July 5, 2007
  • Ok Tom, This is not working.

    I uploaded the .htaccess file and the other 2 as per the readme. The directory structure is:

    Index.php – Site Root
    .htacess – SiteRoot

    all other WP files
    in a folder called /blog

    The Blog works great when I turn of permalinks.

    I also added the Error 404 setting on my control panel…

    Please take a look at it.
    thanks
    Ishan

    Comment | July 17, 2007
  • DesiTech

    Hi Tom,

    I did exactly what you mentioned and was able to run “Create a new blog” link only. Rest of things are not working still.

    Before uploading your files I was not even able to get this “create a new blog” link working.

    my site is like this: http://blogs.mysite.com
    and my new blogs will be: http://blogs.mysite.com/username

    All WP files & urs files are in root dir

    Please help me resolve this issue on my hosted iis server.

    thanks a lot.

    Comment | July 17, 2007
  • Thanks so much for this – it worked like a charm! However, I’m having problems with password-protected entries. The page will just refresh after keying in the correct password. I then gave the ugly URI a try and that allowed me entry into the post. Yay! However, again, I’m not able to make comments without seeing this error: Error in my_thread_global_end(): 1 threads didn’t exit

    My comment is saved tho, just the error message popping up…

    This is minor but I hope there’s a fix for this. BTW, just upgraded to WordPress v 2.2.1 and disabled wp-cache.

    Comment | July 17, 2007
  • Tom

    Hi All,

    Sorry I won’t be able to answer all the recent comments. Things to keep in mind here are:

    1. Your blog has to be on an IIS server and it won’t work with a .htaccess file. It has to have a htaccess.txt file.

    2. I have not tested this with the multi-user edition of wordpress, so cannot help you there.

    3. If the page just hangs, it could be because the server is blocked from fetching the page (it has to look at the page as if it was a user).

    4. Password’s might not work because of the way it gives back the page. The way this script works is it pretends to be a user looking at the site and then it shows what it saw as the 404 error page. That’s why it works. There is nothing in the script that passes the passwords or cookies along, so anything that relies on cookies will not work.

    Thus, it will not work with people who are logged into your blog.

    Comment | July 18, 2007
  • DesiTech

    hi,

    I have installed your files in root dir.
    http://blogs.mysite.com

    Also redirected 404 error page to errorpage.asp

    But when I click on blogs its not showing up. And when I remove permlink it works only for admin blogs. But with any of permlink options its not working.

    I have hosting with thrid party on IIS server. Please help me resolve this issue.

    thanks,
    DesiTech

    Comment | July 18, 2007
  • This worked for me in the first shot.I was scratching my head for three days.Thank you ,i love this…

    I have one doubt.Is this search engine friendly

    Comment | July 27, 2007
  • While I appreciate the effort that’s gone into this script, there is a much simpler solution available which only requires a 3 line php file. I’ve documented it here:

    http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/

    Comment | July 30, 2007
  • Rakesh

    hi

    I am made one blog site url is http://www.2bincdev.com/jra/. Now what I want is, if you scroll down the page you will find a link called “comment” and Email. So I want to make both of them color change from black to red. I have tried so many options by making change in CSS but it doesn’t help. Can you pls suggest me any solution for this

    Thanks

    Comment | August 13, 2007
  • Hello and thank you for the script. I have tried number of solutions but none of them are working. (including this)

    I think that the issue is that even the permalinks that start with index.php don’t work.

    i.e. only the first option with indhttp://www.mobiledeployments.com/?p=123 works. If I change it to http://www.mobiledeployments.com/index.php/2007/08/21/sample-post/

    it will not work either and thus I suspect that the custom permalinks are not working.

    I have my own IIS installation and I can control any settings – I am willign to donate some $ to anybody who can help please.

    Thx

    Tomas

    Comment | August 21, 2007
  • Tom

    Tomas,

    You are running Apache so this solution won’t work for you. You need to upload a real .htaccess file. You are using a server that WordPress was made for.

    Follow the instructions in the WordPress Permalinks area.

    Best,
    Tom

    Comment | August 28, 2007
  • jigs

    Tom, have you tried this with https (SSL) website ?

    It seems MSXML cannot work with SSL sites (or atleast with wild card certs – *.xyz.com)

    I get the following error (on the line xml.send):
    msxml3.dll error ’80072efd’ A connection with the server could not be established

    I think I resolved all other MSXML issues by changing to the following code:

    Set xml = Server.CreateObject(“Msxml2.ServerXMLHTTP.3.0″)
    ‘suppress ssl error messages using below
    xml.setOption 2, 13056

    but cannot get past the connection error.

    Thanks
    -jigs

    Comment | August 30, 2007
  • I applied the whole method but now I get 500 Internal server error.

    Comment | September 9, 2007
  • [...] วันนี้นั่งแก้ไข WordPress เกือบทั้งวันเลย เริ่มจาก ย้าย Catalog มาเป็น Tag จากนั้นก็ลบ Catalog ทั้งหมดเปลี่ยนมาเหลือแค่ 4 อย่าง พอกดดูแล้ว โอ้ว โล่งขึ้นเยอะเลย ต่อจากนั้นก็แก้ Permalinks ให้สามารถใช้ได้บน IIS6 (ถ้าเป็นบน Apache จะง่ายมากแค่มี .htaccess ก็เรียบร้อย) สำหรับขั้นตอนการทำก็ ตามนี้ Using Permalinks แต่สำหรับของผมแล้ว แก้ตามนี้ IIS Permalinks และก็แก้ไขเพิ่มนิดหน่อย ตาม comment ในหน้านี้ Fix Unicode เพื่อให้สามารถใช้ unicode ได้ เท่านี้ก็เรียบร้อย ปอลอ. สำหรับ Plugin อื่นๆ ยังไม่ได้ติดเลย ตอนนี้อยากได้ emotion แบบเว็บ iannnnn.com มาก กับตัวแก้ไขข้อความแบบ wysiwyg แต่วันนี้ง่วงแล้ว พรุ่งนี้ค่อยมาแก้ต่อ ราตรีสวัสดิ์ครับ [...]

    Pingback | September 10, 2007
  • Tom

    Please take a look a this post explaining a better way to get permalinks in IIS using 404 redirect pages:

    http://www.keyboardface.com/archives/2007/09/07/update-for-wordpress-permalinks-on-iis/

    Comment | September 10, 2007
  • scott

    Tried this and it’s great!! Thanks.

    Sidenote: This page is really hard to read however. Black text on dark red/black background?! (Opera 9.0)

    Comment | April 8, 2008
  • Стильные стальные двери Форпост нового поколения
    http://www.alphalock.ru/

    Comment | August 23, 2008
  • HocatoonArcax

    un programma per scaricare?Scusates, potete scrivermi e mettere il link dei migliori scansioni online? Possibilmente in italiano…. ma accetto anche di lingua straniera! Grazie mille a chi mi aiita! :)

    http://www.chatt-gratis.net/javachat/immagini/amore.gif

    Comment | December 7, 2008
  • georseshemi

    Most peoples says that you need, other that you dont.
    So how to choice?

    Comment | December 23, 2008
  • [...] Keyboard Face » WordPress PermaLinks in IIS without the mod_rewrite [...]

    Pingback | March 21, 2009
  • Hi, I have a similar problem with Permalinks on WordPress, IIS.
    My site was installed XAMPP, not IIS.
    I put the file wp-404.handler.php as shown on your website, but the principle works if the Hosting (IIS6) they turned me 404 error, no longer works.
    If I do not activate the 404 error, if it works, but I have no error page and I still have the blank page, but at least Permaliks function.
    Now I have the default Permalinks panel in WordPress.
    I do not know whether to install IIS6 on Vista, I need to install Windows Server ..?
    Thank you very much.
    Good site this.

    Comment | May 27, 2009
  • fantastic! I searched the web for too long for a solution like this. But I have a related issue. If my permalink structure is like /%postname%/, the pages works fine but any request with index.php/anything brings the homepage except the 404 error page. If the permalink is set to include the index.php phrase, then the 404 page works for invalid requests. Please help me how to use the permalink format mysite.com/%postname%/ having the 404 error pages functioning. Thanks in advance.

    Comment | June 7, 2009
  • impopanuadymn

    Hello,

    What are the best web hosting company?

    I’m trying to set up a web site for my new business.

    appreciate your feedback,

    -Nick

    Comment | June 11, 2009

RSS feed for comments on this post. TrackBack URL

Leave a comment


× four = 8

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes