iis6上的wordpress的永久链接设置

来源:互联网 发布:阿里云注册域名 编辑:程序博客网 时间:2024/06/07 21:31

网上有好几个rewrite iis isfilter,经过测试,googlecode的那个无法装载,binaryxxx的那个可以用,但是.html似乎上不去?

下面这个+.html page插件两者共用时,解决问题,所有page都是postname.html。

  

If you install WordPress on IIS you will notice your friendly URLs do not work.  This is because WordPress wants to use an apache add-on called “mod_rewrite.”  The quick rundown of that this does is it will take your friendly browser URL and actually change them to index.php on the back end.  One problem with this method is that IIS does not load apache mods.  Here is an easy and free way around this:

  1. On your IIS Server download and install ISAPI_Rewrite Lite.  This filter does the job of mod_rewrite for IIS.  When downloading make sure to use the free Lite version.  This Lite version does not limit the product very much and will be perfectly fine (and free) for our wordpress blog.  Just install Rewrite Lite to the default locations for this tutorial.
  2. Next add the ISAPI filter to your IIS Site.
    You will find this setting by right clicking yourIIS site -> properties -> ISAPI filters tab -> Add …  Name the filter whatever you wish and your path to your executable should be:
    C:\Program Files\Helicon\ISAPI_Rewrite3\ISAPI_Rewrite.dll
    Click OK on both windows to save your settings.
  3. Next navigate to C:\Program Files\Helicon\ISAPI_Rewrite3
    Here we will edit httpd.conf  (Note:  This is the difference between the pay version and the Lite version.  In the pay version you will need to edit the .htaccess file on your web folders root)
  4. Open the httpd.conf file in wordpad and paste in these lines:
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?p=$1 [NC,L]
  5. Save and exit this file.
  6. To complete your IIS changes, Go to start, run and run the command:  iisreset /restart
  7. Now lets change your WordPress settings.  Navigate to http://yourblog/wp-admin
  8. Navigate to the left side menu bar -> settings -> Permalinks
  9. Now you get to choose how you want your posts to look.  I choose a custom setting and just: /%postname%  This is how you see this blog working today.
  10. Click “Save Changes” and you should see your new friendly URLs!

 

但是第4步的httpd.conf配置有问题。所有页面都导向到首页。

 

后来我采用下面的配置:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(index\.php)*(.*)$ index.php/$2 [NC,L]

测试正常工作。

 

其他配置参考,当blog不在根目录(未测试)

Rule:-

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)$ blog/index.php/$1 [NC,L]

where “blog” is the subdirectory.

Turn permalinks on and use either

/%postname%/ for just a url or
/%postname%.html for articles to end in .html i.e.

 

原创粉丝点击