开发者

Wordpress, IIS7, Permalinks and index.php

开发者 https://www.devze.com 2023-01-08 00:09 出处:网络
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 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.co开发者_如何学Gom/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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号