Skip to:
Content
Pages
Categories
Search
Top
Bottom

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


  • Dailytalker
    Member

    @dailytalker

    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)

  • Dailytalker
    Member

    @dailytalker

    Well the support here is very poor. When you ask something you hardly ever receive help. Sometimes you even get an impolite answer. Is this the way you guys try to get new bbpress-fans?

    There was already the same kind of treatment when I asked for a way to install a facebook connect option. Answer was: It’s no priority and therefore no help.


    Gautam
    Member

    @gautam-gupta

    Use the htaccess bundled with the plugin. The source can also be found here – http://www.technospot.net/blogs/how-to-remove-forum-and-topic-keyword-from-bbpress-url/


    Dailytalker
    Member

    @dailytalker

    Dear Gautam

    I tried out the htaccess-code which is posted on technospot.net. It works for the forum and the member profiles but I cannot enter the admin backend anymore. Do you have an idea how to solve that problem?

    The following link is not working anymore:

    http://www.domain.com/forum/bb-admin/index.php

    When I add the following peace of code (just something I creaded by myself) :

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

    It gives me the following link:

    http://www.domain.com/forum/bb-admin/

    So, it doesn’t work because “index.php” is missing.

    Do you have an idea how I can get this link with “index.php”?

    PS: You already mentioned that problem on your blog….bud maybe you found a solution meanwhile.


    Dailytalker
    Member

    @dailytalker

    I found a solution for the admin-backend link!

    Just ad the following code

    RewriteRule ^bb-admin/$ – [L]

    before this code

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

    and it works!!! Cool.


    I found another mistake. The “topics-RSS” where missing because you deleted one rewrite mod too much. To repair this you need to put the following code just after the mod rewrites for “view”

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

    original code:

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

    Than also the rss-feed for the topics should work.


    Gautam
    Member

    @gautam-gupta

    :-)

    Hello!

    Question Number 1

    Dailytalker do you have any idea if i have any chance of using this if i want to use this if i have http://domain.com/ the exact address of the forum?

    I need something like http://domain.com/name-of-forum/title-of-topic.

    I know that i may be asking too much so … my expectations are way low … but I still would like to know.

    Question Number 2

    Can anyone help me rewrite(htaccess) this http://domain.com/index.php?pagina=$1 into http://domain.com/something


    Dailytalker
    Member

    @dailytalker

    What you can do is what I have….

    http://www.dailytalk.ch/forum

    1st step

    Download the plugin, you find on the link bellow and follow the instructions on that site:

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

    2nd step

    If the name of your forum is “forums” you need to name the RewriteBase /forums/

    RewriteBase /forums/

    If the name of your forum is “community” your RewriteBase is /community/

    RewriteBase /community/

    etc.

    3rd step

    After you have followed the steps of that site you will find some bugs. To solve them do the following:

    To solve the major bugs you need to do this:

    I found a solution for the admin-backend link!

    Just ad the following code

    RewriteRule ^bb-admin/$ – [L]

    before this code

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

    and it works!!! Cool.


    I found another mistake. The “topics-RSS” where missing because you deleted one rewrite mod too much. To repair this you need to put the following code just after the mod rewrites for “view”

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

    original code:

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

    Than also the rss-feed for the topics should work.

    OK thank you very much for your information!

    I was pretty sure that I cannot use this hack while using bbpress straight at the root of a domain.

    Do you have any clue regarding the second question?


    Dailytalker
    Member

    @dailytalker

    Regarding your second question:

    1st

    Go to the admin backend

    2nd

    Go to “settings”

    3rd

    Go to “permalinks”

    4th

    click on “names”

    I think that you might misunderstood what my intentions are.

    I already have preety permalinks enabled. I need the rewrite in order to make a custom page (http://domain.com/index.php?pagina=$1), which I create from some of the content on the front page, be availiable from http://domain.com/something.

    I would like to thank you for your support and for your quick responses.


    Dailytalker
    Member

    @dailytalker

    Before you activate the plugin you must change the permalinks to “name”.

    In my opinion you can use the hack straight at the root of a domain.

    example:

    When your domain is: http://www.domain.com/

    Your rewrite base in this case should be as follows:

    RewriteBase /

    Try it out!

    The rewrite base is from where the rewrite starts. So if the base is /forum/ it starts from “http://www.xxx.com/forum/&#8221;

    When the rewrite base is / it starts from “http://www.xxx.com/&#8221;

    Already tried it! The fact that I am posting here is a result of me not being able to do it straight at the root of a domain after trying this for about a week.

    The front page loads fine but when I try to open any link (forum, topic …..) it appears to be broken.


    Dailytalker
    Member

    @dailytalker

    Did you follow the steps decribed in this topic?

    Did you install the plugin?

    Did you change the permalinks to “name” before activating the plugin?

    Did you change the codes in your htaccess?

    Did you write as rewrite base /?

    Thats what I have in the htaccess of my wp-frontpage:

    RewriteBase /

    So it really must work. I am pretty sure.

    I may be on to something here !

    It seems to be working partially now.

    I was using the steps described here http://blog.markroberthenderson.com/getting-rid-of-forums-and-topic-from-bbpress-permalinks-updated-plugin/comment-page-1/#comment-37 .

    I tried it with the htaccess rules from here http://www.technospot.net/blogs/how-to-remove-forum-and-topic-keyword-from-bbpress-url/ instead those from the plugin dir.

    Now i will try:

    1. admin-backend link

    2. the rss thing that you mentioned somewhere at the middle of the post.

    Thanks!!!

    UPDATE!

    Admin link also working!


    chrishajer
    Participant

    @chrishajer

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