WordPress与Discuz的Rewrite共存(方法二)

WP装在/blog文件夹,DZ装在/bbs文件夹。重写成功。
这是规则,放在站点根目录下.htaccess即可。
#这是正确的 wordpress+discuz 共生.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
#即使DZ装在/bbs目录,还是这么写RewriteBase:
RewriteBase /
RewriteRule ^bbs/archiver/((fid|tid)-[\w\-]+\.html)$ bbs/archiver/index.php?$1
RewriteRule ^bbs/forum-([0-9]+)-([0-9]+)\.html$ bbs/forumdisplay.php?fid=$1&page=$2
RewriteRule ^bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ bbs/viewthread.php?tid=$1&extra=page\%3D$3&page=$2
RewriteRule ^bbs/space-(username|uid)-(.+)\.html$ bbs/space.php?$1=$2
RewriteRule ^bbs/tag-(.+)\.html$ bbs/tag.php?name=$1
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#下面如果是WP装在根目录就是RewriteRule . /index.php [L]
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
这个方法可行,但还是推荐这种方法:http://blog.creke.net/2009/08/wordpressdiscuzrewrite.html。因为它更便于管理

6 comments

  1. Adkins says:

    博主好,我的也是Wordpress 博客,现有一个问题请教,因为根目录下既有index.php又有index.html文件所以想不让博客地址栏隐藏index.php(因为有index.php进去之后老是跳转到index.html)请问如何取消跳转(隐藏)。感谢。

  2. Adkins says:

    写错了,因为有index.html进去之后老是跳转到index.html(我想.html和.php两文件都保留)

  3. Adkins says:

    以下是.htaccess文件代码
    # BEGIN WordPress

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

    # END WordPress

    1. creke says:

      在.htaccess加上

      DirectoryIndex index.php

      应该是你要的效果了吧

  4. 阿呆 says:

    博主啊。我的是根目录wp3.11,子目录bbs下安装dzx1.5,可是dzx1.5无论如何都不行啊。能帮忙看看吧。谢谢了。

    1. creke says:

      呵呵,不好意思,我现在还是WP2.9

Leave a Reply to 阿呆 Cancel reply