Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting rid of /forums/ and /topic/ from bbPress permalinks

  • I’d like to remove “forums” and “topics” from bbPress permalinks.

    This looks ugly:

    http://domain.com/forums/forum/name-of-forum/

    http://domain.com/forums/topic/title-of-topic/

    Therefore I want this:

    http://domain.com/forum/name-of-forum/title-of-topic

    Therefore I downloaded a plugin and followed the steps described on this website:

    http://blog.markroberthenderson.com/getting-rid-of-forums-and-topic-from-bbpress-permalinks-updated-plugin/comment-page-1/#comment-37

    Unfortunately I don’t get it work. I think there are some mod rewrites missing. Unfortunately I am not a mod rewrite expert. Is there anybody who could help me?

    Thats the htaccess code which works with the ugly url:

    # BEGIN bbPress

    Options -MultiViews

    <IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /forum/

    RewriteRule ^page/([0-9]+)/?$ /forum/index.php?page=$1 [L,QSA]

    RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /forum/forum.php?id=$1&page=$2 [L,QSA]

    RewriteRule ^forum/([^/]+)/?$ /forum/forum.php?id=$1 [L,QSA]

    RewriteRule ^forum/?$ /forum/ [R=302,L,QSA]

    RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /forum/topic.php?id=$1&page=$2 [L,QSA]

    RewriteRule ^topic/([^/]+)/?$ /forum/topic.php?id=$1 [L,QSA]

    RewriteRule ^topic/?$ /forum/ [R=302,L,QSA]

    RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ /forum/tags.php?tag=$1&page=$2 [L,QSA]

    RewriteRule ^tags/([^/]+)/?$ /forum/tags.php?tag=$1 [L,QSA]

    RewriteRule ^tags/?$ /forum/tags.php [L,QSA]

    RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ /forum/profile.php?id=$1&page=$2 [L,QSA]

    RewriteRule ^profile/([^/]+)/([^/]+)/?$ /forum/profile.php?id=$1&tab=$2 [L,QSA]

    RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /forum/profile.php?id=$1&tab=$2&page=$3 [L,QSA]

    RewriteRule ^profile/([^/]+)/?$ /forum/profile.php?id=$1 [L,QSA]

    RewriteRule ^profile/?$ /forum/profile.php [L,QSA]

    RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ /forum/view.php?view=$1&page=$2 [L,QSA]

    RewriteRule ^view/([^/]+)/?$ /forum/view.php?view=$1 [L,QSA]

    RewriteRule ^rss/?$ /forum/rss.php [L,QSA]

    RewriteRule ^rss/topics/?$ /forum/rss.php?topics=1 [L,QSA]

    RewriteRule ^rss/forum/([^/]+)/?$ /forum/rss.php?forum=$1 [L,QSA]

    RewriteRule ^rss/forum/([^/]+)/topics/?$ /forum/rss.php?forum=$1&topics=1 [L,QSA]

    RewriteRule ^rss/topic/([^/]+)/?$ /forum/rss.php?topic=$1 [L,QSA]

    RewriteRule ^rss/tags/([^/]+)/?$ /forum/rss.php?tag=$1 [L,QSA]

    RewriteRule ^rss/tags/([^/]+)/topics/?$ /forum/rss.php?tag=$1&topics=1 [L,QSA]

    RewriteRule ^rss/profile/([^/]+)/?$ /forum/rss.php?profile=$1 [L,QSA]

    RewriteRule ^rss/view/([^/]+)/?$ /forum/rss.php?view=$1 [L,QSA]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^.*$ /forum/index.php [L]

    </IfModule>

    # END bbPress

    Thats the htaccess code which should make pretty urls:

    # BEGIN bbPress

    <IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /forum/

    Options +FollowSymlinks

    RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ tags.php?tag=$1&page=$2 [L,QSA]

    RewriteRule ^tags/([^/]+)/?$ tags.php?tag=$1 [L,QSA]

    RewriteRule ^tags/?$ tags.php [L,QSA]

    RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&page=$2 [L,QSA]

    RewriteRule ^profile/([^/]+)/([^/]+)/?$ profile.php?id=$1&tab=$2 [L,QSA]

    RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&tab=$2&page=$3 [L,QSA]

    RewriteRule ^profile/([^/]+)/?$ profile.php?id=$1 [L,QSA]

    RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ view.php?view=$1&page=$2 [L,QSA]

    RewriteRule ^view/([^/]+)/?$ view.php?view=$1 [L,QSA]

    RewriteRule ^rss/?$ rss.php [L,QSA]

    RewriteRule ^rss/forum/([^/]+)/?$ rss.php?forum=$1 [L,QSA]

    RewriteRule ^rss/topic/([^/]+)/?$ rss.php?topic=$1 [L,QSA]

    RewriteRule ^rss/tags/([^/]+)/?$ rss.php?tag=$1 [L,QSA]

    RewriteRule ^rss/profile/([^/]+)/?$ rss.php?profile=$1 [L,QSA]

    RewriteRule ^page/([0-9]+)/?$ ?page=$1 [L,QSA]

    RewriteRule ^([^/]+)/([^/]+)/page/([0-9]+)/?$ topic.php?id=$2&page=$3 [L,QSA]

    RewriteRule ^([^/]+)/([^/]+)/?$ topic.php?id=$2 [L,QSA]

    RewriteRule ^([^/]+)/page/([0-9]+)/?$ forum.php?id=$1&page=$2 [L,QSA]

    RewriteRule ^([^/]+)/?$ forum.php?id=$1 [L,QSA]

    </IfModule>

    # END bbPress

    Whats missing in the second htaccess code? It must be something with “page”, “forum” or “topic”.

Viewing 15 replies - 1 through 15 (of 15 total)
Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.
Skip to toolbar