Search code examples
phpwordpresspermalinks

Wordpress, IIS7, Permalinks and index.php


I know this question may have been asked before, but I have read hundreds of posts all over the Internets and nothing has worked...

I have a wordpress install (WP 3.0), running on MySQL and PHP 5.2.6.

I'm trying to get the permalinks to just be site.com/postname. When I set the permalinks in the settings to just be

/%postname%

It displays as I want it, but I get a 404 on every page (other than the home page).

When it's in this state, if I manually type in site.com/index.php/postname, I get the page, but all the links on the site are pointing to site.com/postname, leading to 404s...

I've been all round the houses on this one, and got in to several different situations. At one point, all the links were going to site.com/postname, and instead of 404'ing, they were all just displaying the home page content


Solution

  • You need to do URL rewriting. This is usually done in the .htaccess file for your site. On IIS you need a third party plugin to provide this functionality.

    Here is my .htaccess from my IIS/WP3 blog, were I host under /blog/ which you could remove from below:

    php_value memory_limit 48M
    Options +FollowSymlinks
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^blog/.* /blog/index.php [NC,L]