BBS » BBPress

.htaccess 解决 bbPress 伪静态404错误,被WordPress思维定势了

(1 post)
  1. admin

    offline
    Key Master


    .htaccess 解决 bbPress 伪静态404错误,被WordPress思维定势了
    http://www.dreamfreeblog.com/bbs/

    被WordPress思维定势了,和 wordpress 不大一样,要手动在 bbpress 安装目录添加 .htaccess,bbpress 也有伪静态 的 URL 重写,英文叫 Pretty permalink,但自从换主机后伪静化后出现 404 错误,折腾了半天找到办法了,但先前的服务器设置后并未进行此步设置,都是apache主机,可能还是有点不同的。

    1.设置伪静态
    2.打开 yourdomain/bbs/bb-admin/rewrite-rules.php 将里面的代码写到 .htaccess 文件里,并在最上面加入一行: Options -MultiViews

    我的代码:
    Options -MultiViews

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /bbs/
    RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /bbs/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^forum/([^/]+)/?$ /bbs/forum.php?id=$1 [L,QSA]
    RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /bbs/topic.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^topic/([^/]+)/?$ /bbs/topic.php?id=$1 [L,QSA]
    RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ /bbs/tags.php?tag=$1&page=$2 [L,QSA]
    RewriteRule ^tags/([^/]+)/?$ /bbs/tags.php?tag=$1 [L,QSA]
    RewriteRule ^tags/?$ /bbs/tags.php [L,QSA]
    RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ /bbs/profile.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^profile/([^/]+)/([^/]+)/?$ /bbs/profile.php?id=$1&tab=$2 [L,QSA]
    RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /bbs/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
    RewriteRule ^profile/([^/]+)/?$ /bbs/profile.php?id=$1 [L,QSA]
    RewriteRule ^profile/?$ /bbs/profile.php [L,QSA]
    RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ /bbs/view.php?view=$1&page=$2 [L,QSA]
    RewriteRule ^view/([^/]+)/?$ /bbs/view.php?view=$1 [L,QSA]
    RewriteRule ^rss/?$ /bbs/rss.php [L,QSA]
    RewriteRule ^rss/topics/?$ /bbs/rss.php?topics=1 [L,QSA]
    RewriteRule ^rss/forum/([^/]+)/?$ /bbs/rss.php?forum=$1 [L,QSA]
    RewriteRule ^rss/forum/([^/]+)/topics/?$ /bbs/rss.php?forum=$1&topics=1 [L,QSA]
    RewriteRule ^rss/topic/([^/]+)/?$ /bbs/rss.php?topic=$1 [L,QSA]
    RewriteRule ^rss/tags/([^/]+)/?$ /bbs/rss.php?tag=$1 [L,QSA]
    RewriteRule ^rss/profile/([^/]+)/?$ /bbs/rss.php?profile=$1 [L,QSA]
    RewriteRule ^rss/view/([^/]+)/?$ /bbs/rss.php?view=$1 [L,QSA]
    </IfModule>

    希望对你有用,嘿嘿

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.



0.205 - 17 queries