简体   繁体   中英

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

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]

IIS doesn't support a .htaccess file, but you can use the 'URL Rewrite' module to achieve the same pretty urls.

This article (from 2008) describes how it works. The URL rewrite module is available in the web platform installer , as it is a Microsoft add on for IIS (not specific for Wordpress).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM