How to remove forum and topic keyword from bbpress url Como remover o fórum e palavras-chave tópico url bbpress
I had been trying lot of forum softwares ( around 5 till now ) from last Friday and was testing BBPRESS yesterday. Eu tinha tentado lote de softwares do fórum (em torno de 5 até agora) de sexta-feira passada e estava testando BBPress ontem. The new version9.x has lot of improvement over its 8.x version but one thing I found common in both of them O version9.x novo lote de melhoria em relação a sua versão 8.x, mas uma coisa que eu encontrei em comum de ambos
- “Forum” keyword was appended when you accesss any forum eg http://sitename.com/<forum-directory>/ forum /<forum slug> "Fórum palavra-chave" foi anexado quando você accesss por exemplo, qualquer fórum 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> "Tema-chave", também foi acrescentada para cada post feito por exemplo http://sitename.com <forum-directory> / tópico / tema <actualy 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. Agora eu entendo por que tanto as palavras-chave são obrigatórios, mas novamente a partir do ponto de SEO não tem nenhum significado a menos que alguém corre um fórum sobre "fóruns" tópico. The next thing I did was look around for a hack and luckily A próxima coisa que fiz foi olhar ao redor para um hack e felizmente at this post there was a solution neste post não foi uma solução , but not actual plugin was supported. , Mas não foi apoiada plugin real. I copied the code given there and tested around and was successful. Copiei o código dado lá e testado ao redor e foi bem sucedida.
Before I start, I have just tested around with the code given by the memebers over there. Antes de começar, tenho testado apenas com o código dado pelo memebers lá. So test it before you use it. Então, testá-lo antes de usá-lo. And moreover I am not supporting it as I did not make it and cant do it either. E além disso não estou apoiando ele porque eu não fiz isso e não posso fazê-lo também.
I made a plugin from the code given and took re-write code for .htaccess files. Eu fiz um plugin a partir do código dado e tomou re-escrever o código. Htaccess. Here is how they look Aqui está como eles olham
PLUGIN:( Taken from the forum link ) Plugin: (Extraído do link do fórum)
<?php <? php
/* / *
Plugin Name: Remove Topic Forum Plugin Nome: Remover o tópico no fórum
Plugin URI: http://bbpress.org/ Plugin URI: http://bbpress.org/
Description: Allows to remove forum and topic word in url Descrição: Permite remover fórum e palavra tema no url
Author: Ashish Mohta Autor: Ashish Mohta
Version: 1.0 Versão: 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 ) { my_get_forum_link_filter função ($ link, $ forum_id = 0) (
//retrieve the forum object / / recuperar o objeto fórum
$forum = get_forum( get_forum_id( $forum_id )); $ forum = get_forum (get_forum_id ($ forum_id));//check for rewrite / / check for reescrita
$rewrite = bb_get_option( 'mod_rewrite' ); reescrever bb_get_option $ = ( "mod_rewrite ');
if ( $rewrite ) { if ($ reescrever) (
//what kind of rewrite there is? / / que tipo de reescrever o que existe? slug use “forum_slug” column, else the column is “forum_id” uso slug "forum_slug coluna", então a coluna é "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); $ coluna = ($ reescrever === 'lesmas')?(' forum_slug'):(' forum_id');// change /forum/pets-discussions in /pets-discussions / / Alteração / forum / discussões em animais de estimação / animais de estimação de discussões
// this work only if the rewrite module is modded! / / Este trabalho apenas se o módulo é reescrever modded!
// and this work only if the slugged name will NEVER / / E este trabalho apenas se o nome slugged NUNCA
// be a reserved word like “rss” or “bb-images” / / Ser uma palavra reservada como "RSS" ou "bb-imagens"
// and this is achieved by a filter on bb_slug_sanitize / / E isto é alcançado por um filtro em bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ link = str_replace fórum ( '/'. $ forum-> coluna, $ forum-> coluna, $ link);
} )
return $link.”/”; // Very important line! return $ link ."/"; / / linha de Muito importante! // Added extra slash :Ashish / / Barra Added extra: 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) { my_get_topic_link_filter função ($ link, $ topic_id = 0) (
//retrieve the topic object / / recuperar o objeto tópico
$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 / / recuperar o objeto fórum que é o recipiente tópico
$forum = get_forum( get_forum_id( $topic->forum_id )); $ forum topic = get_forum (get_forum_id ($-> forum_id));//check for rewrite / / check for reescrita
$rewrite = bb_get_option( 'mod_rewrite' ); reescrever bb_get_option $ = ( "mod_rewrite ');
if ( $rewrite ) { if ($ reescrever) (
//what kind of rewrite there is? / / que tipo de reescrever o que existe? slug use “forum_slug” column, else the column is “forum_id” uso slug "forum_slug coluna", então a coluna é "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); $ coluna = ($ reescrever === 'lesmas')?(' forum_slug'):(' forum_id');//create the “forum/pets-discussions” chunk to show the hierarchical relation forum->topic / / cria o "Fórum de estimação discussões" pedaço de mostrar o fórum relação hierárquica-> Opções
$forum_nice_uri = “forum/” . forum_nice_uri $ forum = "/". $forum->$column . $ forum-> $ coluna. “/”; "/";//attach the hierarchical chunk to the link / / anexar o bloco hierárquico para o link
$link = str_replace(bb_get_option('uri'), bb_get_option('uri') . $forum_nice_uri, $link); $ link = str_replace bb_get_option (( 'uri'), Uri bb_get_option ( ''). forum_nice_uri, $ link);// change /forum/pets-discussions/topic/my-sweet-dog in /pets-discussions/my-sweet-dog / / Alteração / forum / pets discussões / tópico / my-dog-doce in / pets-discussions/my-sweet-dog
// this work only if the rewrite module is modded! / / Este trabalho apenas se o módulo é reescrever modded!
// and this work only if the slugged name will NEVER / / E este trabalho apenas se o nome slugged NUNCA
// be a reserved word like “rss” or “bb-images” / / Ser uma palavra reservada como "RSS" ou "bb-imagens"
// and this is achieved by a filter on bb_slug_sanitize / / E isto é alcançado por um filtro em bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ link = str_replace fórum ( '/'. $ forum-> coluna, $ forum-> coluna, $ link);
$link = str_replace('topic/' . $topic->$column , $topic->$column, $link); $ link = str_replace tópico ( '/'. $ topic-> coluna, $ topic-> coluna, $ link);
} )return $link.”/” ; // Very important line! return $ link. "/" / / linha de Muito importante! // Added Extra Slash :Ashish / / Adicionado 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 ) { my_bb_slug_sanitize_filter função (comprimento text_slug $, $ text_original = ", $ = 0) (
// add “r-” by regex when the string begins with “bb-” or “my-” or is a reserved word / / Add "r" por regex quando a corda começa com "BB-" ou "meu-" ou é uma palavra reservada
return preg_replace('/^(my-.*|bb-.*|rss|tags|view|profiles)$/', 'r-$1′, $text_slug); return preg_replace ('/^( my-.* | bb-.* | RSS | Tags | | visualizar perfis )$/', '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: arquivo. htcaccess:
( Taken from one same forum link and modified a little. You will need to remove the MULTIVIEW from your existing .htaccess file ) (Extraído de um link mesmo fórum e modificou um pouco. Você precisará remover o MULTIVIEW do seu arquivo. Existentes htaccess)
<IfModule mod_rewrite.c> <IfModule Mod_rewrite.c>
RewriteEngine On RewriteEngine On
RewriteBase /forums RewriteBase FórunsOptions +FollowSymlinks Options + FollowSymLinks
RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ tags.php?tag=$1&page=$2 [L,QSA] RewriteRule ^ tags /([^/]+)/ página / ([0-9 ]+)/?$ tags.php? Tag = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^tags/([^/]+)/?$ tags.php?tag=$1 [L,QSA] RewriteRule ^ tags /([^/]+)/?$ tags.php? Tag = $ 1 [L, QSA]
RewriteRule ^tags/?$ tags.php [L,QSA] Tags RewriteRule ^ /? $ Tags.php [L, QSA]
RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&page=$2 [L,QSA] RewriteRule ^ perfil /([^/]+)/ página / ([0-9 ]+)/?$ profile.php? Id = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/?$ profile.php?id=$1&tab=$2 [L,QSA] RewriteRule ^ perfil /([^/]+)/([^/]+)/?$ profile.php? Id = $ 1 & tab = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&tab=$2&page=$3 [L,QSA] RewriteRule ^ perfil /([^/]+)/([^/]+)/ página / ([0-9 ]+)/?$ profile.php? Id = $ 1 & tab = $ 2 & page = $ 3 [L, QSA ]
RewriteRule ^profile/([^/]+)/?$ profile.php?id=$1 [L,QSA] RewriteRule ^ perfil /([^/]+)/?$ profile.php? Id = $ 1 [L, QSA]
RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ view.php?view=$1&page=$2 [L,QSA] RewriteRule ^ ver /([^/]+)/ página / ([0-9 ]+)/?$ view.php? Ver = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^view/([^/]+)/?$ view.php?view=$1 [L,QSA] RewriteRule ^ ver /([^/]+)/?$ view.php? Ver = $ 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? Fórum = $ 1 [L, QSA]
RewriteRule ^rss/topic/([^/]+)/?$ rss.php?topic=$1 [L,QSA] RewriteRule ^ rss / assunto /([^/]+)/?$ rss.php? Topic = $ 1 [L, QSA]
RewriteRule ^rss/tags/([^/]+)/?$ rss.php?tag=$1 [L,QSA] RewriteRule ^ rss / tags /([^/]+)/?$ rss.php? Tag = $ 1 [L, QSA]
RewriteRule ^rss/profile/([^/]+)/?$ rss.php?profile=$1 [L,QSA] RewriteRule ^ rss / profile /([^/]+)/?$ rss.php? Perfil = $ 1 [L, QSA]RewriteRule ^([^.]+)/([^.]+)/page/([0-9]+)/?$ topic.php?id=$2&page=$3 [L,QSA] RewriteRule ^([^.]+)/([^.]+)/ página / ([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 ^([^/.]+)/ página / ([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. Coloque o arquivo em meu diretório plugin plugin-e. Htaccess no diretório raiz bbPress. Active the plugin. Plugin do Active. and it should work fine. e ele deve funcionar bem.
The Problem I find with this. O problema que eu encontrar com isso.
- The Link to BBpress admin board link does not work from main site. O link para BBpress link board não funciona do site principal. It redirects to home page. Ele redireciona para a página principal. You will need to manually type the link to go inside. Você precisará digitar manualmente o link para ir para dentro.
- 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 . No caso de você digitar algo que não existe como http://sitename.com/ <bbpress-directory> sdaksda / retorna http://sitename.com/ <bbpress-directory> / /. Uma barra extra.
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. Exceto esses 2, não há problema que eu vejo até agora mas que não é fácil prever como eu não tenho muitas mensagens ou usuários. So if you want to try it out Portanto, se você quiser testá-lo download the files here baixar os arquivos aqui . . You can give your feedback here if you can improve it. Você pode dar sua opinião aqui se você pode melhorá-lo. And If somebody wants they can support the plugin and enhance it. E se alguém quiser que podem apoiar o plugin e melhorá-lo. You can see Você pode ver demo of this on the forum demo deste no fórum I tested on but You wont be able to register and anyways it just a test forum Eu testei em mas você vai ser capaz de registrar e de qualquer maneira é um fórum de teste
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |

Posted on 4th April 2008 by Postado em 4 de abril de 2008 por Ashish Mohta Ashish Mohta , A tech blogger who writes about solving day to day problems of people who use computer. , A tecnologia blogueiro que escreve sobre resolver problemas do dia a dia das pessoas que usam o computador. He also writes on How to use the applications like Office, PC tips, Online tools,Browsers and more. All posts by Ele também escreve sobre "Como utilizar as aplicações do Office, PC dicas, ferramentas online, navegadores e muito mais. Todos os lugares por Ashish Mohta Ashish Mohta | Connect with me @ | Connect with me @ Twitter Twitter | | Linkedin Linkedin | | Facebook Facebook | | Stumble Stumble


























Free Email Subscription
Thanks! Obrigado! It works wonders. Ele funciona maravilhas. Running it now on the community site Callofduty.se. Executá-lo agora no site da comunidade Callofduty.se. Your sh*t is the only EASY solution to this problem – thanks again! Seu merda é a única solução fácil para este problema - thanks again!
(Running it with bbPress 1.01 if anyone would like to know) (Correndo com bbPress 1,01 Se alguém quiser saber)
Leave your response! Deixe sua resposta!