How to remove forum and topic keyword from bbpress url Πώς να αφαιρέσετε το φόρουμ και η λέξη-κλειδί θέμα από bbPress url
I had been trying lot of forum softwares ( around 5 till now ) from last Friday and was testing BBPRESS yesterday. Είχα προσπαθήσει πολλές λογισμικά φόρουμ (περίπου 5 μέχρι τώρα) από την περασμένη Παρασκευή και είχε τον έλεγχο bbPress χθες. The new version9.x has lot of improvement over its 8.x version but one thing I found common in both of them Η νέα version9.x έχει μεγάλη βελτίωση σε σχέση με 8.x εκδοχή της, αλλά ένα πράγμα βρήκα κοινά και στις δύο από αυτά
- “Forum” keyword was appended when you accesss any forum eg http://sitename.com/<forum-directory>/ forum /<forum slug> "Φόρουμ" λέξη-κλειδί ήταν συνημμένη όταν είναι προσπελάσιμα από κάθε π.χ. φόρουμ 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> "Θέμα" λέξη-κλειδί ήταν συνημμένη επίσης για κάθε θέση που π.χ. http://sitename.com <forum-directory> / θέμα / <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. Τώρα καταλαβαίνω γιατί είναι τόσο οι λέξεις-κλειδιά reqired αλλά και πάλι από το σημείο SEO δεν έχει κανένα νόημα Εάν δεν τρέχει κάποιος ένα φόρουμ με θέμα "φόρουμ" θέμα. The next thing I did was look around for a hack and luckily Το επόμενο πράγμα που έκανα ήταν ματιά για μια αμυχή και ευτυχώς at this post there was a solution σε αυτό το post υπήρξε μια λύση , but not actual plugin was supported. , Αλλά δεν είναι πραγματικές plugin υποστηρίχθηκε. I copied the code given there and tested around and was successful. Αντέγραψα τον κωδικό που υπάρχει και γύρω δοκιμαστεί και ήταν επιτυχής.
Before I start, I have just tested around with the code given by the memebers over there. Πριν αρχίσω, έχω μόνο γύρω δοκιμαστεί με τον κώδικα που έδωσε η memebers εκεί. So test it before you use it. Γι 'αυτό δοκιμή πριν το χρησιμοποιήσετε. And moreover I am not supporting it as I did not make it and cant do it either. Και άλλωστε δεν είμαι αυτή την υποστήριξη, όπως εγώ δεν το έκανε και λοξοτομώ το κάνει είτε.
I made a plugin from the code given and took re-write code for .htaccess files. Έκανα ένα plugin από την αναληφθείσα κωδικό και πήρε εκ νέου κώδικα για τις γράψετε. Htaccess αρχεία. Here is how they look Εδώ είναι το πώς φαίνονται
PLUGIN:( Taken from the forum link ) PLUGIN: (Απόσπασμα από το σύνδεσμο φόρουμ)
<?php <? php
/* / *
Plugin Name: Remove Topic Forum Plugin Όνομα: Κατάργηση Θέμα Φόρουμ
Plugin URI: http://bbpress.org/ Plugin URI: http://bbpress.org/
Description: Allows to remove forum and topic word in url Περιγραφή: Επιτρέπει την αφαίρεση φόρουμ και λέξη θέμα στο url
Author: Ashish Mohta Συντάκτης: Ashish Mohta
Version: 1.0 Έκδοση: 1.0
Author URI: http://www.technospot.net/blogs/ Συντάκτης URI: http://www.technospot.net/blogs/
*/ * /function my_get_forum_link_filter( $link , $forum_id = 0 ) { my_get_forum_link_filter λειτουργία ($ link, $ forum_id = 0) (
//retrieve the forum object / / ανακτήσετε το αντικείμενο φόρουμ
$forum = get_forum( get_forum_id( $forum_id )); $ forum = get_forum (get_forum_id ($ forum_id))?//check for rewrite / / έλεγχος για ξαναγράψει
$rewrite = bb_get_option( 'mod_rewrite' ); $ ξαναγράψει = bb_get_option ( 'mod_rewrite')?
if ( $rewrite ) { if ($ ξαναγράψει) (
//what kind of rewrite there is? / / τι είδους ξαναγράψει είναι εκεί; slug use “forum_slug” column, else the column is “forum_id” γυμνοσάλιαγκα χρήση "forum_slug" στήλη, αλλιώς η στήλη "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); στήλη = $ ($ ξαναγράψει === 'γυμνοσάλιαγκες')?(' forum_slug'):(' forum_id')?// change /forum/pets-discussions in /pets-discussions / / Αλλαγή / forum / κατοικίδια ζώα-συζητήσεις / κατοικίδια ζώα-συζητήσεις
// this work only if the rewrite module is modded! / / Αυτό το έργο μόνο αν το ξαναγράψουμε ενότητα είναι modded!
// and this work only if the slugged name will NEVER / / Και αυτό το έργο μόνο αν το όνομα θα slugged ΠΟΤΕ
// be a reserved word like “rss” or “bb-images” / / Να είναι δεσμευμένη λέξη, όπως "RSS" ή "bb-εικόνες"
// and this is achieved by a filter on bb_slug_sanitize / / Και αυτό επιτυγχάνεται με ένα φίλτρο για bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ link = str_replace φόρουμ ( '/'. $ φόρουμ-> $ στήλη, $ forum-> $ στήλη, $ link)?
} )
return $link.”/”; // Very important line! return $ link ."/"; / / Πολύ σημαντική γραμμή! // Added extra slash :Ashish / / Added επιπλέον κάθετος: 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 λειτουργία ($ link, $ topic_id = 0) (
//retrieve the topic object / / ανακτήσετε το αντικείμενο θέμα
$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 / / ανακτούν το αντικείμενο φόρουμ που είναι το δοχείο θέμα
$forum = get_forum( get_forum_id( $topic->forum_id )); $ forum = get_forum (get_forum_id ($ θέμα-> forum_id))?//check for rewrite / / έλεγχος για ξαναγράψει
$rewrite = bb_get_option( 'mod_rewrite' ); $ ξαναγράψει = bb_get_option ( 'mod_rewrite')?
if ( $rewrite ) { if ($ ξαναγράψει) (
//what kind of rewrite there is? / / τι είδους ξαναγράψει είναι εκεί; slug use “forum_slug” column, else the column is “forum_id” γυμνοσάλιαγκα χρήση "forum_slug" στήλη, αλλιώς η στήλη "forum_id"
$column = ($rewrite === 'slugs')?('forum_slug'):('forum_id'); στήλη = $ ($ ξαναγράψει === 'γυμνοσάλιαγκες')?(' forum_slug'):(' forum_id')?//create the “forum/pets-discussions” chunk to show the hierarchical relation forum->topic / / δημιουργία του "forum / κατοικίδια-συζητήσεις" κομμάτι για να δείτε την ιεραρχική σχέση φόρουμ-> θέμα
$forum_nice_uri = “forum/” . $ forum_nice_uri = "forum /". $forum->$column . $ forum-> $ στήλη. “/”; "/"?//attach the hierarchical chunk to the link / / αποδίδουν την ιεραρχική κομμάτι στο σύνδεσμο
$link = str_replace(bb_get_option('uri'), bb_get_option('uri') . $forum_nice_uri, $link); $ link = 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 / / Αλλαγή / forum / κατοικίδια ζώα-συζητήσεις / θέματος /-μου γλυκιά-σκυλί στο / pets-discussions/my-sweet-dog
// this work only if the rewrite module is modded! / / Αυτό το έργο μόνο αν το ξαναγράψουμε ενότητα είναι modded!
// and this work only if the slugged name will NEVER / / Και αυτό το έργο μόνο αν το όνομα θα slugged ΠΟΤΕ
// be a reserved word like “rss” or “bb-images” / / Να είναι δεσμευμένη λέξη, όπως "RSS" ή "bb-εικόνες"
// and this is achieved by a filter on bb_slug_sanitize / / Και αυτό επιτυγχάνεται με ένα φίλτρο για bb_slug_sanitize
$link = str_replace('forum/' . $forum->$column , $forum->$column, $link); $ link = str_replace φόρουμ ( '/'. $ φόρουμ-> $ στήλη, $ forum-> $ στήλη, $ link)?
$link = str_replace('topic/' . $topic->$column , $topic->$column, $link); $ link = str_replace θέμα ( '/'. $ θέμα-> $ στήλη, $ θέμα-> $ στήλη, $ link)?
} )return $link.”/” ; // Very important line! return $ link. "/"? / / Πολύ σημαντική γραμμή! // 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 ) { 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-" από regex όταν η συμβολοσειρά ξεκινά με "BB-" ή "μου" ή είναι δεσμευμένη λέξη
return preg_replace('/^(my-.*|bb-.*|rss|tags|view|profiles)$/', 'r-$1′, $text_slug); preg_replace επιστροφή ('/^(-μου .* | bb-.* | rss | tags | άποψη | προφίλ )$/', '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 αρχείου:
( Taken from one same forum link and modified a little. You will need to remove the MULTIVIEW from your existing .htaccess file ) (Απόσπασμα από ένα ίδιο σύνδεσμο φόρουμ και τροποποιηθεί λίγο. Θα χρειαστεί να αφαιρέσετε το MultiView από τις υπάρχουσες. Htaccess αρχείο σας)
<IfModule mod_rewrite.c> <IfModule Mod_rewrite.c>
RewriteEngine On Στις RewriteEngine
RewriteBase /forums RewriteBase / φόρουμOptions +FollowSymlinks Επιλογές FollowSymLinks +
RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ tags.php?tag=$1&page=$2 [L,QSA] RewriteRule ^ ετικέτες /([^/]+)/ σελίδα / ([0-9 ]+)/?$ tags.php; tag = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^tags/([^/]+)/?$ tags.php?tag=$1 [L,QSA] RewriteRule ^ ετικέτες /([^/]+)/?$ tags.php; tag = $ 1 [L, QSA]
RewriteRule ^tags/?$ tags.php [L,QSA] RewriteRule ^ ετικέτες /? $ Tags.php [L, QSA]
RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&page=$2 [L,QSA] RewriteRule ^ προφίλ /([^/]+)/ Σελίδα / ([0-9 ]+)/?$ profile.php? Id = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/?$ profile.php?id=$1&tab=$2 [L,QSA] RewriteRule ^ προφίλ /([^/]+)/([^/]+)/?$ profile.php? Id = $ 1 & tab = $ 2 [L, QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ profile.php?id=$1&tab=$2&page=$3 [L,QSA] RewriteRule ^ προφίλ /([^/]+)/([^/]+)/ Σελίδα / ([0-9 ]+)/?$ profile.php? Id = $ 1 & tab = $ 2 & page = $ 3 [L, QSA ]
RewriteRule ^profile/([^/]+)/?$ profile.php?id=$1 [L,QSA] RewriteRule ^ προφίλ /([^/]+)/?$ profile.php? Id = $ 1 [L, QSA]
RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ view.php?view=$1&page=$2 [L,QSA] RewriteRule ^ άποψη /([^/]+)/ σελίδα / ([0-9 ]+)/?$ view.php? Άποψη = $ 1 & page = $ 2 [L, QSA]
RewriteRule ^view/([^/]+)/?$ view.php?view=$1 [L,QSA] RewriteRule ^ άποψη /([^/]+)/?$ view.php; άποψη = $ 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; φόρουμ = $ 1 [L, QSA]
RewriteRule ^rss/topic/([^/]+)/?$ rss.php?topic=$1 [L,QSA] RewriteRule ^ rss / θέμα /([^/]+)/?$ rss.php; θέμα = $ 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 / προφίλ /([^/]+)/?$ rss.php; προφίλ = $ 1 [L, QSA]RewriteRule ^([^.]+)/([^.]+)/page/([0-9]+)/?$ topic.php?id=$2&page=$3 [L,QSA] RewriteRule ^([^.]+)/([^.]+)/ σελίδα / ([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 ^([^/.]+)/ σελίδα / ([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. Τοποθετήστε το plugin στο αρχείο-κατάλογο plugin μου και. Htaccess αρχείο στο bbPress κατάλογο ρίζας. Active the plugin. Ενεργό το plugin. and it should work fine. και θα πρέπει να δουλεύουν μια χαρά.
The Problem I find with this. Το πρόβλημα βρίσκω με αυτό.
- The Link to BBpress admin board link does not work from main site. Ο Σύνδεσμος σε σύνδεση admin bbPress του σκάφους δεν λειτουργεί από την κύρια περιοχή. It redirects to home page. Θα ανακατευθύνσεις στην αρχική σελίδα. You will need to manually type the link to go inside. Θα χρειαστεί να πληκτρολογήσετε το link για να πάει μέσα.
- 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 . Σε περίπτωση που κάτι είδος το οποίο δεν υφίσταται ως http://sitename.com/ <bbpress-directory> / sdaksda επιστρέφει http://sitename.com/ <bbpress-directory> / /. Ένα επιπλέον slash.
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. Εκτός από αυτά τα 2 δεν υπάρχει πρόβλημα που βλέπω μέχρι τώρα, αλλά δεν είναι εύκολο να προβλεφθούν, όπως Ι dont έχει πολλές θέσεις ή των χρηστών. So if you want to try it out Έτσι, εάν θέλετε να το δοκιμάσετε download the files here κατεβάστε το αρχείο εδώ . . You can give your feedback here if you can improve it. Μπορείτε να δώσετε τα σχόλιά σας εδώ αν μπορείτε να το βελτιώσουν. And If somebody wants they can support the plugin and enhance it. Και αν κάποιος θέλει να μπορεί να υποστηρίξει το plugin και να την προάγουν. You can see Μπορείτε να δείτε demo of this on the forum demo του παρόντος στο φόρουμ I tested on but You wont be able to register and anyways it just a test forum Θα δοκιμαστεί για σας, αλλά συνηθίζει να είναι σε θέση να καταγράψει και ούτως ή άλλως είναι απλώς ένα φόρουμ δοκιμή
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |

Posted on 4th April 2008 by Καταχωρήθηκε στις 4 Απριλίου 2008 από Ashish Mohta Ashish Mohta , A tech blogger who writes about solving day to day problems of people who use computer. , A τεχνολογίας blogger που γράφει για την επίλυση των καθημερινών προβλημάτων των ανθρώπων που χρησιμοποιούν τον υπολογιστή. He also writes on How to use the applications like Office, PC tips, Online tools,Browsers and more. All posts by Γράφει επίσης για το πώς να χρησιμοποιήσει τις εφαρμογές όπως το γραφείο, τις άκρες PC, on-line εργαλεία, Φυλλομετρητές και περισσότερο. Όλες οι θέσεις από Ashish Mohta Ashish Mohta | Connect with me @ | Connect with me @ Twitter Κελάδημα | | Linkedin Linkedin | | Facebook Facebook | | Stumble Παραπάτημα


























Free Email Subscription
Thanks! Ευχαριστώ! It works wonders. Λειτουργεί θαύματα. Running it now on the community site Callofduty.se. Λειτουργίας του στην ιστοσελίδα κοινότητα τώρα Callofduty.se. Your sh*t is the only EASY solution to this problem – thanks again! Σας sh * t είναι η μόνη εύκολη λύση στο πρόβλημα αυτό - ευχαριστώ και πάλι!
(Running it with bbPress 1.01 if anyone would like to know) (Αυτό Λειτουργία bbPress 1,01 αν κάποιος θα ήθελε να μάθει)
Leave your response! Αφήστε την απάντησή σας!