How to remove forum and topic keyword from bbpress url Ako odstrániť fóra alebo témy kľúčové slovo z bbpress url
I had been trying lot of forum softwares ( around 5 till now ) from last Friday and was testing BBPRESS yesterday. Musel som sa snažil veľa forum softvér (asi 5 až teraz), od minulého piatka a testoval BBPress včera. The new version9.x has lot of improvement over its 8.x version but one thing I found common in both of them Nový version9.x má veľa zlepšenie oproti jeho 8.x verzia, ale jedna vec, čo som našiel spoločnú v oboch z nich
- “Forum” keyword was appended when you accesss any forum eg http://sitename.com/<forum-directory>/ forum /<forum slug> "Forum" keyword bola pripojená pri každom fóre accesss napr http://sitename.com/ <forum-directory> / forum / <forum slug>
- “topic” keyword was also appended for every post made eg http://sitename.com<forum-directory>/ topic /<actualy topic slug> "Téma" kľúčových slov bol tiež priložený u každé miesto sa napr http://sitename.com <forum-directory> / tému / <actualy tému slug>
Now I understand why both the keywords are reqired but again from SEO point it has no meaning unless somebody runs a forum on “forums” topic. Teraz chápem, prečo sú obe kľúčové slová, reqired, ale opäť z bodu SEO nemá žiadny význam, ak niekto prevádzkuje fórum na tému "fórach" tému. The next thing I did was look around for a hack and luckily Ďalšia vec, ktorú som urobil, bolo pozrieť po hack a našťastie at this post there was a solution na tento post bol roztok , but not actual plugin was supported. , Ale nie aktuálne plugin bol podporený. I copied the code given there and tested around and was successful. I skopírovali kód inštrukcie a testované v okolí a bol úspešný.
Before I start, I have just tested around with the code given by the memebers over there. Skôr než začnem, musím jednoducho skúša si s kódom danej memebers tam. So test it before you use it. Takže test je pred použitím. And moreover I am not supporting it as I did not make it and cant do it either. A navyše ja nie som podporiť to, ako som neurobil, a to buď prevýšenia.
I made a plugin from the code given and took re-write code for .htaccess files. Urobil som plugin z daného kódu a vzal re-písať kód. Htaccess. Here is how they look Tu je to, ako vyzerajú
PLUGIN:( Taken from the forum link ) PLUGIN: (Prevzaté z fóra link)
<?php <? Php
/* / *
Plugin Name: Remove Topic Forum Plugin Meno: Odstrániť Téma Forum
Plugin URI: http://bbpress.org/ Plugin URI: http://bbpress.org/
Description: Allows to remove forum and topic word in url Popis: Umožňuje odstrániť fórum a tému slovo v url
Author: Ashish Mohta Autor: Ashish Mohta
Version: 1.0 Verzia: 1.0
Author URI: http://www.technospot.net/blogs/ Autor URI: http://www.technospot.net/blogs/
*/ * /function my_get_forum_link_filter( $link , $forum_id = 0 ) { Funkcia my_get_forum_link_filter ($ link, $ forum_id = 0) (
//retrieve the forum object / / Načítanie fórum objekt
$forum = get_forum( get_forum_id( $forum_id )); forum = $ get_forum (get_forum_id ($ forum_id));//check for rewrite / / Kontrola prepísanie
$rewrite = bb_get_option( 'mod_rewrite' ); $ Rewrite = bb_get_option ( 'mod_rewrite');
if ( $rewrite ) { if ($ rewrite) (
//what kind of rewrite there is? / / Aká prepísať tam je? slug use “forum_slug” column, else the column is “forum_id” slimák použitie "forum_slug" stĺpci, inak je stĺpec "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); $ Stĺpec = ($ rewrite === 'slimáci')?(' forum_slug'):(' forum_id');// change /forum/pets-discussions in /pets-discussions / / Zmena / forum / zvieratá-diskusie v zvieratá-diskusia
// this work only if the rewrite module is modded! / / Toto fungovať len v prípade, že nová verzia modulu je modded!
// and this work only if the slugged name will NEVER / / A to len vtedy, keď udrel meno nikdy
// be a reserved word like “rss” or “bb-images” / / Byť rezervovaným slovom ako "rss", alebo "bb-obrazy"
// and this is achieved by a filter on bb_slug_sanitize / / A toto je dosiahnuť filter na bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ Odkaz = str_replace ( 'forum /'. $ Forum-> $ stĺpec, $ forum-> $ stĺpec, $ link);
} )
return $link.”/”; // Very important line! return $ link ."/"; / / Veľmi dôležité line! // Added extra slash :Ashish / / Added extra lomkou: Ashish
} )add_filter( 'get_forum_link', 'my_get_forum_link_filter' ); add_filter ( 'get_forum_link', 'my_get_forum_link_filter');
function my_get_topic_link_filter( $link, $topic_id = 0) { Funkcia my_get_topic_link_filter ($ link, $ topic_id = 0) (
//retrieve the topic object / / Načítanie tému objekt
$topic = get_topic( get_topic_id( $topic_id )); $ Topic = get_topic (get_topic_id ($ topic_id));//retrieve the forum object that is the topic container / / Načítanie fórum objekt, ktorý je téma kontajner
$forum = get_forum( get_forum_id( $topic->forum_id )); forum = $ get_forum (get_forum_id ($ topic-> forum_id));//check for rewrite / / Kontrola prepísanie
$rewrite = bb_get_option( 'mod_rewrite' ); $ Rewrite = bb_get_option ( 'mod_rewrite');
if ( $rewrite ) { if ($ rewrite) (
//what kind of rewrite there is? / / Aká prepísať tam je? slug use “forum_slug” column, else the column is “forum_id” slimák použitie "forum_slug" stĺpci, inak je stĺpec "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); $ Stĺpec = ($ rewrite === 'slimáci')?(' forum_slug'):(' forum_id');//create the “forum/pets-discussions” chunk to show the hierarchical relation forum->topic / / Vytvorenie "forum zvieratá-diskusie" kus pre zobrazenie hierarchického vzťahu forum-> tému
$forum_nice_uri = “forum/” . $ Forum_nice_uri = "forum /". $forum->$column . $ Forum-> $ stĺpec. “/”; "/";//attach the hierarchical chunk to the link / / Attach hierarchickú kus na odkaz
$link = str_replace(bb_get_option('uri'), bb_get_option('uri') . $forum_nice_uri, $link); $ Odkaz = str_replace (bb_get_option ( 'uri'), bb_get_option ( 'uri'). Forum_nice_uri $, $ link);// change /forum/pets-discussions/topic/my-sweet-dog in /pets-discussions/my-sweet-dog / / Zmena / forum / zvieratá-diskusia / tému / my-sweet-pes v / pets-discussions/my-sweet-dog
// this work only if the rewrite module is modded! / / Toto fungovať len v prípade, že nová verzia modulu je modded!
// and this work only if the slugged name will NEVER / / A to len vtedy, keď udrel meno nikdy
// be a reserved word like “rss” or “bb-images” / / Byť rezervovaným slovom ako "rss", alebo "bb-obrazy"
// and this is achieved by a filter on bb_slug_sanitize / / A toto je dosiahnuť filter na bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ Odkaz = str_replace ( 'forum /'. $ Forum-> $ stĺpec, $ forum-> $ stĺpec, $ link);
$link = str_replace('topic/' . $topic->$column , $topic->$column, $link); $ Odkaz = str_replace ( 'tému /'. $ Topic-> $ stĺpec, $ topic-> $ stĺpec, $ link);
} )return $link.”/” ; // Very important line! return $ link. "/", / / Veľmi dôležité line! // Added Extra Slash :Ashish / / Added Extra Slash: Ashish
} )add_filter( 'get_topic_link', 'my_get_topic_link_filter' ); add_filter ( 'get_topic_link', 'my_get_topic_link_filter');
function my_bb_slug_sanitize_filter( $text_slug, $text_original = ”, $length = 0 ) { Funkcia my_bb_slug_sanitize_filter ($ text_slug, text_original $ = ", $ length = 0) (
// add “r-” by regex when the string begins with “bb-” or “my-” or is a reserved word / / Add "r-", keď by regex reťazec začína na "BB-" alebo "my-" alebo je vyhradené slovo
return preg_replace('/^(my-.*|bb-.*|rss|tags|view|profiles)$/', 'r-$1′, $text_slug); návrat preg_replace ('/^( my-.* | bb-.* | RSS | tagy | pohľad | profily )$/', 'r-$ 1', $ text_slug);
} )add_filter( 'bb_slug_sanitize', 'my_bb_slug_sanitize_filter' ); add_filter ( 'bb_slug_sanitize', 'my_bb_slug_sanitize_filter');
?> ?>
.htcaccess file: . Htcaccess súboru:
( Taken from one same forum link and modified a little. You will need to remove the MULTIVIEW from your existing .htaccess file ) (Prevzaté z jedného rovnakého fóra odkaz a upravil trochu. Budete musieť odstrániť MultiView z vašich existujúcich. Htaccess)
<IfModule mod_rewrite.c> <IfModule Mod_rewrite.c>
RewriteEngine On RewriteEngine On
RewriteBase /forums RewriteBase / forumsOptions +FollowSymlinks Options + FollowSymLinks
RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ tags.php?tag=$1&page=$2 [L,QSA] RewriteRule ^ značky /([^/]+)/ stránka / ([0-9 ]+)/?$ tags.php? Tag = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^tags/([^/]+)/?$ tags.php?tag=$1 [L,QSA] RewriteRule ^ značky /([^/]+)/?$ tags.php? Tag = $ 1 [L, QSA]
RewriteRule ^tags/?$ tags.php [L,QSA] RewriteRule ^ tags /? $ Tags.php [L, QSA]
RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&page=$2 [L,QSA] RewriteRule ^ profil /([^/]+)/ stránka / ([0-9 ]+)/?$ profile.php? Id = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/?$ profile.php?id=$1&tab=$2 [L,QSA] RewriteRule ^ profil /([^/]+)/([^/]+)/?$ profile.php? Id = $ 1 & tab = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&tab=$2&page=$3 [L,QSA] RewriteRule ^ profil /([^/]+)/([^/]+)/ stránka / ([0-9 ]+)/?$ profile.php? Id = $ 1 & tab = $ 2 & page = $ 3 [L, QSA ]
RewriteRule ^profile/([^/]+)/?$ profile.php?id=$1 [L,QSA] RewriteRule ^ profil /([^/]+)/?$ profile.php? Id = $ 1 [L, QSA]
RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ view.php?view=$1&page=$2 [L,QSA] RewriteRule ^ názor /([^/]+)/ stránka / ([0-9 ]+)/?$ view.php? View = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^view/([^/]+)/?$ view.php?view=$1 [L,QSA] RewriteRule ^ názor /([^/]+)/?$ view.php? View = $ 1 [L, QSA]
RewriteRule ^rss/?$ rss.php [L,QSA] RewriteRule ^ rss /? $ Rss.php [L, QSA]
RewriteRule ^rss/forum/([^/]+)/?$ rss.php?forum=$1 [L,QSA] RewriteRule ^ rss / forum /([^/]+)/?$ rss.php? Forum = $ 1 [L, QSA]
RewriteRule ^rss/topic/([^/]+)/?$ rss.php?topic=$1 [L,QSA] RewriteRule ^ rss / tému /([^/]+)/?$ rss.php? Topic = $ 1 [L, QSA]
RewriteRule ^rss/tags/([^/]+)/?$ rss.php?tag=$1 [L,QSA] RewriteRule ^ rss / značky /([^/]+)/?$ rss.php? Tag = $ 1 [L, QSA]
RewriteRule ^rss/profile/([^/]+)/?$ rss.php?profile=$1 [L,QSA] RewriteRule ^ rss / profil /([^/]+)/?$ rss.php? Profile = $ 1 [L, QSA]RewriteRule ^([^.]+)/([^.]+)/page/([0-9]+)/?$ topic.php?id=$2&page=$3 [L,QSA] RewriteRule ^([^.]+)/([^.]+)/ stránka / ([0-9 ]+)/?$ topic.php? Id = $ 2 & page = $ 3 [L, QSA]
RewriteRule ^([^/.]+)/([^.]+)/?$ topic.php?id=$2 [L,QSA] RewriteRule ^([^/.]+)/([^.]+)/?$ topic.php? Id = $ 2 [L, QSA]RewriteRule ^([^/.]+)/page/([0-9]+)/?$ forum.php?id=$1&page=$2 [L,QSA] RewriteRule ^([^/.]+)/ stránka / ([0-9 ]+)/?$ forum.php? Id = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^([^/.]+)/?$ forum.php?id=$1 [L,QSA] RewriteRule ^([^/.]+)/?$ forum.php? Id = $ 1 [L, QSA]
</IfModule> </ IfModule>
Place the plugin file in my-plugin directory and .htaccess file in bbpress root directory. Miesto pluginom v mojej-plugin a adresárov. Bbpress htaccess v koreňovom adresári. Active the plugin. Aktívne plugin. and it should work fine. a mal by fungovať dobre.
The Problem I find with this. Problém som s to nájsť.
- The Link to BBpress admin board link does not work from main site. Odkaz na palube admin BBPress odkaz nefunguje z hlavnej stránky. It redirects to home page. To presmeruje na domovskú stránku. You will need to manually type the link to go inside. Budete musieť ručne odkaz dovnútra.
- In case you type something which does not exists as http://sitename.com/<bbpress-directory>/sdaksda it returns http://sitename.com/<bbpress-directory>// . An extra slash . V prípade, že ste typ, ktorý nie je niečo, čo existuje ako http://sitename.com/ <bbpress-directory> / sdaksda vracia http://sitename.com/ <bbpress-directory> / /. Extra lomkou.
Except these 2 there is no problem I see so far but Its not easy to predict as I dont have lot of posts or users. Okrem týchto 2 nie je žiadny problém vidím tak ďaleko, ale jej nie je ľahké predpovedať, ako já dont mať veľa pracovných miest alebo užívateľov. So if you want to try it out Takže ak chcete vyskúšať download the files here Súbory na stiahnutie tu . . You can give your feedback here if you can improve it. Môžete si dať svoju reakciu, ak môžete vylepšiť. And If somebody wants they can support the plugin and enhance it. Ak niekto chce a oni môžu podporovať plugin a posilniť ju. You can see Môžete vidieť demo of this on the forum demo tejto skutočnosti na fóre I tested on but You wont be able to register and anyways it just a test forum Testoval som pre, ale ste zvyknutý byť schopný zaregistrovať, a kdekoľvek je to len test forum
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |

Posted on 4th April 2008 by Publikované pred: dňa 4. apríla 2008 Ashish Mohta Ashish Mohta , A Professional Tech blogger, Editor and Writer who talks about solving day to day problems of people who use computer. , Professional Tech blogger, redaktor a spisovateľ, ktorý hovorí o riešení každodenných problémov ľudí, ktorí používajú počítač. He also writes on How to use the applications like Office, PC tips, Online tools,Browsers and more. All posts by On tiež píše o používaní aplikácií, ako úrad, PC tipy, on-line nástroje, prehliadača a ďalšie. Všetky príspevky od Ashish Mohta Ashish Mohta | Connect with me @ | Pripojte sa mnou @ Twitter Twitter | | Linkedin LinkedIn | | Facebook Facebook | | Stumble Klopýtnutí


























Sign up for our daily email newsletter
Thanks! Vďaka! It works wonders. Funguje to zázraky. Running it now on the community site Callofduty.se. Teraz beží na komunitný web Callofduty.se. Your sh*t is the only EASY solution to this problem – thanks again! Vaša sh * t je len EASY riešenie tohto problému - ešte raz vďaka!
(Running it with bbPress 1.01 if anyone would like to know) (Running to s bbPress 1.01, ak by niekto chcel vedieť)
Leave your response! Nechajte Vašu odpoveď!