IIS and wordpress perma links using IIS Mod Rewrite Pro

Discussion in 'Site & Server Administration' started by wishbringer_2112, Feb 27, 2008.

  1. #1
    I am having a hell of a time trying to get IIS Mod Rewrite Pro to work with my wordpress blog, I am trying to remove the index.php out of the URL I have tried many different mod_rewrite rules but none have worked. The blog at the moment is in a subdirectory but when I can get this solved I want to move it to the root, does this matter?

    Thanks for any help
    Neil
     
    wishbringer_2112, Feb 27, 2008 IP
  2. zisto

    zisto Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just add this line of code at the beginning of index.php

    $_SERVER['REQUEST_URI']=$_SERVER['HTTP_X_ORIGINAL_URL'];

    This is a requirement because IIS does not support the server variable REQUEST_URI, which is used by wordpress to resolve the requested page.

    The directory of your wordpress application does matter at all. If you add the code above, everything will work as with apache.

    Cheers

    PS Make sure you use the original rules in .htaccess
     
    zisto, Feb 27, 2008 IP
  3. wishbringer_2112

    wishbringer_2112 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I will give this a shot, thanks for your tip!
     
    wishbringer_2112, Feb 28, 2008 IP
  4. zisto

    zisto Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Even better, put that line of code at the beginning of wp-settings.php. This works for both wordpress and wordpress-mu.

    http://mu.wordpress.org/forums/topic.php?id=6208
     
    zisto, Feb 29, 2008 IP
  5. wishbringer_2112

    wishbringer_2112 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks again for your help, For some reason I placed this code inside our pages but no luck. Maybe you could post a .htaccess file that works. I tried changing the settings inside wordpress dealing with the permalinks but no luck.
     
    wishbringer_2112, Mar 4, 2008 IP
  6. zisto

    zisto Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You just need the following on IIS:

    1. IIS Mod-Rewrite pro
    2. The original wordpress .htaccess rules
    3. Add the following code at the beginning of wp-settings.php:

    $_SERVER['REQUEST_URI']=$_SERVER['HTTP_X_ORIGINAL_URL'];

    The .htaccess rules:
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]


    This is a 100% working solution and it's really that simple. You are probably missing something or your wordpress app is misconfigured. The code line above must be copied right after the <?php symbol. Check you security settings, make sure the .htaccess file is in the wordpress root. Also if you use IIS mod-rewrite in test mode remember to restart IIS every 30 or less minutes.

    Finally, if you have been guessworking by changing the code in wordpress files, I recommend that you re-install wordpress.

    Cheers!
     
    zisto, Mar 4, 2008 IP