locked
WordPress "almost pretty" permalinks with IIS6 RRS feed

  • Question

  • User1973730279 posted

    WordPress "almost pretty" permalinks with IIS6

    I have been searching for a published answer for days to this question, but without success, so now I'll post my explicit problem. This is a question about WordPress on Windows. I will give lots of details.

    I have a web site hosted on a shared hosting platform with Windows Server 2003 and IIS 6. I have ISAPI_Rewrite v2 installed. I am not in a position to dink with very much on the server, such as instal new DLLs. My access to the virtual server is in fact through a Helm interface.

    I have installed WordPress 3.1.1 and developed a CMS web site using it. I have a number of custom pages and I do not use the conventional posts feature typical of WordPress blogs of old. My WordPress installation is in a subfolder called wpcore but one can still access the web site using the bare domain name with no subfolder specified because I have duplicated the index.php file in the root but changed the line:-

        require('./wp-blog-header.php');

    to require('./wpcore/wp-blog-header.php');

    This means that you can keep all your WordPress installation files isolated. It is common practice and is regarded by some as good practice for various reasons. I do not think it presents a complicattion for what I am trying to achieve.

    My desire now is to enable pretty permalinks, or at least "almost pretty" permalinks. Instead of accessing pages using the out-of-the-box URL scheme such as:-

        http://www.mywebsite.co.uk/?page_id=7

    I should prefer to use a scheme such as:-

        http://www.mywebsite.co.uk/index.php/pagename

    - for example: http://www.mywebsite.co.uk/index.php/about

    This is another normal practice for WordPress users. I should be able to do this by selecting what is called a custom structure in my Permalinks Settings page (in the WordPress admin), namely:-

        /index.php/%postname%

    I am not sure if it is possible to get rid of the "index.php/" part (which is what makes it "almost pretty" rather than a true pretty permalink) and in truth I do not really mind about that. The WordPress documentation calls this a "PATHINFO permalink".

    Custom permalinks typically require one of these URL redirecting modules installed. (It is not entirely clear whether a PATHINFO permalink requires the ISAPI_Rewrite module or not.) Since this is a Windows/IIS installation rather than the Linux/Apache setup favoured by WordPress, I do not the have mod_rewrite module available, but I do have ISAPI_Rewrite v2. Apparently this should work. Installing ISAPI_Rewrite creates a file called httpd.ini in my web root and in here should go the re-write rules. It even includes a simple rule for free when you activate it in my web hosting solution. That is probably a Helm feature.

    I have activated the ISAPI_Rewrite module. Almost pretty permalinks do not work. I am not sure if I need to add new rules to my httpd.ini or not. The WordPress doco is a little vague on this. Other forums have suggested fragments of code to add but I have not got it to work.

    I am not familiar enough with the under-the-hood workings of wordPress to appreciate how the heck it figures out that the URL:-

         http://www.mywebsite.co.uk/index.php/about

    should get re-written to render:-

        http://www.mywebsite.co.uk/?page_id=7 or even http://www.mywebsite.co.uk/index.php?page_id=7 instead.

    I do know it's the page "slug" that is referenced here (so typically my page entitled "About" will have a slug of "about"), but how it does the mapping to page_id=7 escapes me.

    Presumably the Custom Structure specified in the Permalinks Setting page, together with the appropriate substitution rule in the httpd.ini file, will take care of this... and that is the part that is baffling me. I am not great with regular expressions but I can get by, but nothing I have read or tried has worked.

    So if anyone can suggest what I need to do to complete this I should be grateful. It is driving me bananas.

    Sunday, May 1, 2011 3:03 PM

Answers