Skip to:
Content
Pages
Categories
Search
Top
Bottom

Name based permalinks without page/ and forums/

  • @jurasiks

    Participant

    It’s possible to remove forums & page in name based permalinks?

    bbpress 1.0.2 htaccess:

    # BEGIN bbPress

    Options -MultiViews

    <IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /

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

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

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

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

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

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

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

    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 ^profile/?$ /profile.php [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/topics/?$ /rss.php?topics=1 [L,QSA]

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

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

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

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

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

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

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

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

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

    </IfModule>

    # END bbPress

Viewing 14 replies - 1 through 14 (of 14 total)
  • @kevinryman

    Participant

    I would also like to know this. :)

    @mr_pelle

    Participant

    Hi! After 3 hours of brute-force testing, I found a working configuration:

    # BEGIN bbPress

    Options -MultiViews

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forum/

    #handle admin stuff
    RewriteRule ^bb-admin/.*$ - [L,QSA]

    # handle the rest
    RewriteRule ^page/([0-9]+)/?$ ?page=$1 [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 ^profile/?$ profile.php [L,QSA]

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

    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 ^view/([^/]+)/page/([0-9]+)/?$ view.php?view=$1&page=$2 [L,QSA]
    RewriteRule ^view/([^/]+)/?$ view.php?view=$1 [L,QSA]

    # handle forums
    RewriteRule ^([^/]+)/page/([0-9]+)/?$ forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^([^/]+)/$ forum.php?id=$1 [L,QSA] # no '?' before the closing '$' this time: very important!

    # handle topics
    RewriteRule ^([^/]+)/([^/]+)/page/([0-9]+)/?$ topic.php?id=$2&page=$3 [L,QSA]
    RewriteRule ^([^/]+)/([^/]+)/$ topic.php?id=$2 [L,QSA] # no '?' before the closing '$' this time: very important!

    # handle non-existent pages
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ index.php [L]
    </IfModule>

    # END bbPress

    @mr_pelle

    Participant

    I’m currently also working on a function, integrated with the plugin, that updates/restores .htaccess: updating is easy, but restoring needs to grab an hook on “plugin deactivated” event or a dedicated admin page where users can call these functions.

    I would opt for the former, but I don’t know if there is any way for a plugin to know the moment when it gets deactivated…

    Any clue?

    @mr_pelle

    Participant

    Hi! I’ve worked all day on the plugin, but now it finally works as it should! ^_^

    I’ve also implemented 2 functions that grab both “plugin activated” and “plugin deactivated” events in order to swap .htaccess and the new file. Unfortunately you still have to change .htaccess permissions if you want the plugin to update it, but the only other way is manual edit…

    I’ve embedded them in the plugin by Ashish Mohta and Mark Robert Henderson, but I don’t know how to proceed: what do you think would be the better way to publish the updated plugin?

    @mr_pelle

    Participant

    Sorry for keeping posting, but I really would like to submit the “upgraded” plugin, though I do not want to name it after me, as it is mainly a work by Ashish Mohta and Mark Robert Henderson…

    Does anyone have a mail of one of them or another way to contact them?

    @jurasiks

    Participant

    Just upload plugin and make credits for original authors

    @mr_pelle

    Participant

    I sent an email to Ashish Mohta asking for his thoughts about the updated plugin: if I won’t get an answer soon, I’ll create the missing documentation and upload the plugin.

    @mr_pelle

    Participant

    No answer, so I made a plugin upload request today: “Nicer Permalinks” will be online soon! ^_^

    @justbartlett

    Member

    Man I can’t wait for this to go online! Out of curiosity are there any existing SEO plugins or sitemap plugins for BBPress? Gracias in advance!

    @mr_pelle

    Participant

    “Nicer Permalinks” now available!!

    @mr_pelle

    Participant

    Has anyone tried my plugin? I had no feedback but a 1 star rating since yesterday… 0_o”

    @sureshdrim

    Participant

    @ Mr_pelle


    Thanks for ur plugin.I tried it but unfortunately it didn’t worked for my forum.I changed the RewriteBase as follows while I was testing it on localhost as my test forum is installed at http://localhost/bbpress/

    &lt;IfModule mod_rewrite.c&gt;

    RewriteEngine On

    RewriteBase /bbpress/

    Then replaced the code of .htaccess with the code in nicer-htaccess &gt; activated plugin &gt; activated permalinks name based option from admin panel.

    But got following error:

    “Oops! This link appears to be broken.”

    in Google Chrome while navigating the forum.

    Secondly even I tried to test ur plugin on my server where my forum is installed at http://www.xyz.com/ so I changed RewriteBase to

    &lt;IfModule mod_rewrite.c&gt;

    RewriteEngine On

    RewriteBase /

    But I could not find any .htaccess file in root folder on server.So I tried to upload it through FTP but got an error :

    “The name you specified is not allowed”

    coz of “.” in .htaccess name.

    Please help..

    @mr_pelle

    Participant

    […] Then replaced the code of .htaccess with the code in nicer-htaccess &gt; activated plugin &gt; activated permalinks name based option from admin panel.

    But got following error: […]

    Hi! It seems you did not read my installation instructions carefully:

    (1) FIRST activate name based permalinks

    (2) then perform automatic/manual update

    As for “name not allowed” on the server, do the same: go to bbPress admin panel and activate name based permalinks. It will generate the htaccess file automatically, if folder permissions are set. If not, set them or create the file yourself (you may leave it blank) and let bbPress do the rest. THEN you may perform (2).

    @eefjehend

    Member

    Got this working, really thanks!!! It was very needed.

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