Permalinks not working on windows server (11 posts)

  1. owain182
    Posted 6 years ago #

    Hi All

    I know this is a topic that's been covered plenty of times before, but I have been reading through various threads and websites for the past couple of hours and still can't fix my problem!

    I have moved my wordpress site to a new server ( Windows server I belive ) and am trying to set up pretty permalinks to /%postname%/ or something like that, but I keep getting 404 errors after changing the settings

    I couldn't find a htaccess file with hidden folders shown, but I didn't get an error about htaccess when changing the permalink settings

    I've tried creating my own htaccess with settings from various threads on here and elsewhere to no avail

    I know it's something to do with the mod_rewrite, or the lack of it on my server but am struggling with what else to try!

    Can anyone help me, I've probably left out a lot of important bits!

    it's quite important I can set this up


  2. Chris_K
    Posted 6 years ago #

    With your typical Windows IIS server you won't find (or use) an .htaccess file. Check out the Permalinks page and try out the "Almost Pretty" permalinks.

  3. owain182
    Posted 6 years ago #

    Thanks, yeah I realised about the .htaccess but it didn't click straight away
    I can get the almost pretty permalinks to work with /index.php/ but was hoping there was a way i could bypass that bit!

    There's a lot I've read about the IIS and there being several things you can install to get rid of it, but am not sure whether I can do that with my setup

    I shall have another read now


  4. owain182
    Posted 6 years ago #

    Any other ideas, I've got it working with /index.php/ but the guy who's site it is would much rather without as it is going to be a website rather than a blog

    I tried a plugin that was meant to get around it, but that didn't work either it just stopped my /index.php/ permalinks from working aswell

    Anything else to try would be much appreciated, I saw there was a couple of things in the official wordpress guide but wasn't sure whether I'd be able to do the IIS 7 mods

  5. Chris_K
    Posted 6 years ago #

    How much access do you have to the server? Is it shared host or do you have full admin access?


  6. OWC
    Posted 6 years ago #

    I use IX WEB HOSTING, and this is what I found out about their their Windwos hosting service and using permalinks:

    "We are sorry for possible inconvenience. In order to use permalinks in wordpress there should be mod_rewrite installed on the server that is only possible on Linux servers with Apache web server. As we have checked your domain is on Windows IIS server that does not have mod_rewrite. I regret, but it is not possible to use permalinks on Windows server. If you really need to use permalinks we would recommend you to move your domain to Linux hosting package."

    I'm still asking questions, but does this really sound like a satisfactory explanation?

    Does anybody have a different opinion on this issue...

  7. OWC
    Posted 6 years ago #

  8. Thunderbunny.us
    Posted 6 years ago #

    OWC, I am also on that hosting in an identical situation. I tried the downloadable 404 page but it still fails...

    What was your 404 redirect? I used "pagename.php" (since it stated relative path and I use my site root and blog root).

    Or did you use the code refered to in the page?

  9. brucecollins
    Posted 6 years ago #

    Just wondering if you could shed some light. When I installed WordPress on my Windows server, a .htaccess file was not created (unless I can’t see it), and I was wondering if you could share with me where it should go? And is the following code all I need to place it in?

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* /index.php [L]

    Also, once created, does the server or IIS require a reboot?

  10. Samuel B

    Posted 6 years ago #

  11. OWC
    Posted 6 years ago #

    @ Thunderbunny.us

    Paste one of the following three different options inside of the wp-404-handler.php file and see which one works for you. I've used #1 and #2 in two different blogs. #3 didn't work.

    Then in the IX control panel add a 404, 404,2 and 404.3 error pages with these two settings: URL and /wp-404-handler.php

    That's all.

    // This is the default file for the site. Usually index.php
    $default = 'index.php';

    // The name of this file.
    // Set this value for the URL in Custom Error Properties of your website in IIS.
    // Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
    // 404 & 404;2 & 404;3 > URL (Requires a '/' prefix in IIS).
    $thisfile = '404-handler.php';

    $_SERVER['ORIG_PATH_TRANSLATED'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_TRANSLATED']);
    $_SERVER['SCRIPT_FILENAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_FILENAME']);
    $_SERVER['ORIG_PATH_INFO'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_INFO']);
    $_SERVER['SCRIPT_NAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_NAME']);
    $_SERVER['PHP_SELF'] = str_replace($thisfile, $default, $_SERVER['PHP_SELF']);
    $_SERVER['PATH_INFO'] = false;

    $qs =& $_SERVER['QUERY_STRING'];
    $ru =& $_SERVER['REQUEST_URI'];
    $pos = strrpos($qs, '://');
    $pos = strpos($qs, '/', $pos + 4);
    $_SERVER['URL'] = $ru = substr($qs, $pos);
    $qs = trim(stristr($ru, '?'), '?');

    // Required for WordPress 2.8+

    // Fix GET vars
    foreach ( $_GET as $var => $val ) {
    if ( substr($var, 0, 3) == '404') {
    if ( strstr($var, '?') ) {
    $newvar = substr($var, strpos($var, '?') + 1);
    $_GET[$newvar] = $val;


    $_SERVER['REQUEST_URI'] = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], ':80')+3);

    $qs = $_SERVER['QUERY_STRING'];
    $pos = strrpos($qs, '://');
    $pos = strpos($qs, '/', $pos + 4);
    $_SERVER['REQUEST_URI'] = substr($qs, $pos);

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.