miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
The Other miniBB Support Forums / The Other /   

Even more Search Engine friendly mod_rewrite

Page  Page 4 of 4:  « Previous  1  2  3  4  
Author Anonymous
Guest
#46 | Posted: 4 Aug 2007 09:33 
Do you guys know how I would call the actual form name or topic name variable so I can echo it in the URL?
I want to do something like this:
{$main_url}/FORUM_NAME_{$forum}_{$topic}_

My .htaccess looks like:
RewriteRule _([0-9]+)_([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vthread&forum=$1&topic=$2&page=$3&mdrw=on
RewriteRule _([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on

where the output would be:
http://yourforum.com/forum_topic_1_0.html

Author Paul
Lead Developer
#47 | Posted: 6 Aug 2007 09:48 
Anonymous
If you are not familiar with coding, PHP and miniBB code structure, it's not worth even to start discussing... this would require A LOT of custom modifications, and we ourselves are offering only paid solution regarding this.

But - as discussed above - you better notice that keywords in the URL won't give you a lot of effort. Instead, they will give you a lot of troubles when upgrading the board.

Still, I am so often asked about keyword-rich URLs that I will probably consider this as an option in new miniBB releases. But I am not sure when it will be available... miniBB is indexed well with numerical "static" URLs, too, I don't see a lot of benefit of making a lot of changes to the core because of fake unuseful option.

Author radeldudel
Registered
#48 | Posted: 13 Sep 2007 04:37 
Sorry to maybe open an old diskussion, but I'd like to give two thoughts about this:

1) there is forum software with keywords in urls, have a look at
http://www.stevepavlina.com/forums/

2) you could use the same trick amazon uses for its keyword-urls, they just add the keywords to the url and ignore them for finding the right page. The bold part of this link can be replaced by anything and still amazon would find the right page:
http://www.amazon.de/Harry-Potter-Philosophers-Joanne-Rowling/dp/0747532745/ref=sr_1_1/303-1953473-6684255?ie=UTF8&s=books-intl-de&qid=11896 76108&sr=1-1
so they got the keywords, and still use their old links.

For the rest, as long as the urls are static I don't mind urls much.

regards,
Sam

Author Paul
Lead Developer
#49 | Posted: 13 Sep 2007 05:32 | Edited by: Paul 
1) I could add that miniBB has possibility to have keyword-riched URLs (in your example there is vBulletin forums), but it is not cheap regarding a lot of modifications of core files need to be made, and later very difficult updates.

http://www.polishforums.com/
http://www.vicevlasu.cz/
http://www.omlazeni.cz/

It's possible but I personally doubt it really makes a big sense.

For minibbtest we already have a PR=5 despite it has no keyword riched URLs, no useful content and pages are not indexed at all (NOINDEX,NOFOLLOW attribute there). I think Google interprets importance of the page other way, not giving the keyword-riched URLs a high value ;-) As I described above, such type URLs are only useful if somebody is pointing to them from the other sites, and that way the keywords will be taken into attention.

2) The bold part of this link can be replaced by anything and still amazon would find the right page

It seems a bit wrong approach, since it could be deliberately faken by the enemies, which will emulate the duplicate content and that way strike the site from Google. The vBulletin example you provided works correctly (also as the PolishForums example I've mentioned and which I have worked myself on - .cz forums' mod_rewrite is 3rd party implementation and they are opened to duplicate content faking).

Author Anonymous
Guest
#50 | Posted: 19 Sep 2007 05:57 
So clean urls is not an option on minibb?

Author tom322
Registered
#51 | Posted: 19 Sep 2007 10:24 
So clean urls is not an option on minibb?

If you compare the test forum at http://minibb.org/minibb-test.php versus this forum you'll notice this forum has option of URL rewrite on and has "clean" URLs (if by "clean" you mean that).

Author joseph38
Registered
#52 | Posted: 11 Apr 2008 09:58 | Edited by: joseph38 
I got this to work on my site, and I registered just to share with everybody how to get it working. You will have to modify bb_func_vthread.php and bb_func_vtopic.php and httpd.conf .

As an example of what my URLs look like, here is the URL for for showing the topics in a forum (see bb_func_vtopic) :

http://ezcorean.com/korean_grammar/Passive_and_Causative_verbs
http://ezcorean.com/korean_grammar/Verb_tenses/examples_of_Korean_under-appreciating_tense
http://ezcorean.com/korean_study/newspapers/newspaper_reading
http://ezcorean.com/korean_grammar/Verbs_and_Adjectives/action_verbs_modifying_nouns

the /korean_grammar/ is ignored by my mod_rewrite as I have created an imaginary home for the forums with using the forum_group column to hold master forums (I don't know if the default comes with a forum_group column in minibb_forums table or not but I added one ). In the examples which follow, you will have to modify to remove the reference to that. I'd rather leave it as it is here, working, and let you remove them yourself, rather than post a non-working version.


---------------------------- bb_func_vtopic.php handling by httpd.conf ---------------------
http://ezcorean.com/korean_grammar/Passive_and_Causative_verbs

In this example, the forum name = passive_and_causative_verbs

it is trapped and rewritten by this httpd.conf RewriteRule

RewriteMap rewrite_forum txt:/var/myowndictionary/current/rewrite_forum.txt
RewriteRule ^/korean_(grammar|study)/([^/]*) /index.php&subaction=vtopic&forum=${rewrite_forum:$2|} [L]

(that declares a map file to use to rewrite the rule)

---------------------------- bb_func_vthread.php handling by httpd.conf ---------------------
Then there are the individual threads (see bb_func_vthread.php) . The url looks like:

http://ezcorean.com/korean_grammar/Passive_and_Causative_verbs/passive_and_causative

And it matches these httpd.conf rewriteRules:

RewriteMap rewrite_forum txt:/var/myowndictionary/current/rewrite_forum.txt
RewriteMap rewrite_topic txt:/var/myowndictionary/current/rewrite_topic.txt
RewriteRule ^/korean_(grammar|study)/([^/]*)/([^/]*) /index.php&subaction=vthread&forum=${rewrite_forum:$2|}&topic=${rewrite_topic:$3|} [L]


(of course you only need to declare the maps only one time).

--------------------------- making the map files ---------------------

the RewriteMap is just a file. On the left side is the thing you want to match against the string, and on the right side is the substitution . For rewrite_forum.txt the left side is the forum name,the right side is the forum_id

like this:

important_and_confusing_vocabulary 36
movies_--_korean_or_otherwise 151
most_valuable_words_level_D 28
similar_but_different_vocabulary 37
Parts_of_Speech 8


the same thing for the rewrite_topics.txt

When you create the links, just replace the spaces in the title and forum names with underscores.

this step will require some changes to the topic_title field

-- change all question marks and / in the database to spaces or - ....... using somethign like

mysql> update minibb_topics set topic_title = replace(topic_title,'/','-');
mysql> update minibb_topics set topic_title = replace(topic_title,'?','');

To create the map files using mysql, use the following command:
mysql> create table fake_topics as select topic_id, topic_title from minibb_topics;
mysql> update fake_topics set topic_title = replace(topic_title,' ','_'); // this replaces spaces with underscores, or, URL friendly.
mysql> select topic_title, topic_id from minibb_topics into outfile '/tmp/rewrite_topics.txt';

and then copy that to the appropriate place.
---------------------------------generating the links in _vtopic and in _vthread.php -----------------------

Also, these 2 php functions will retrieve the topics in the correct format. I experimented with urlencoding them, but that didn't come out as being necessary for a reason I don't understand now.

function make_forum_string ( $forum) {
global $db_mysql;
// no need to urlencode
return str_replace(' ', '_', mod_queryOne($db_mysql, "select forum_name from mb_forums where forum_id = $forum " ) );
}
function make_topic_string ( $topic) {
global $db_mysql;
// no need to urlencode
return str_replace(' ', '_', mod_queryOne($db_mysql, "select topic_title from mb_topics where topic_id = $topic " ) );
}

---------------------- bb_func_vtopic.php -------------------------
I have the following code there

$linkToTopic="{$main_url}/" . make_topic_string($topic);

--------------------- bb_func_vthread.php ----------------------

$forum_title2 = make_forum_string( $forum );

-------------- bb_func_ptopic.php ---------------------------------
]Furthermore add

$TT = str_replace('/','-',$TT); // for joseph

and
$f=fopen('/var/myowndictionary/current/rewrite_topics.txt',"a");
fwrite($f,"\n" . str_replace(' ','_',$topic_title)."\t". mod_queryOne($db_mysql,"select max(topic_id) from mb_topics")."\n");
fclose($f);

to minibb_func_ptopic.php

Author Paul
Lead Developer
#53 | Posted: 14 Apr 2008 02:54 | Edited by: Paul 
It is not enough just to replace spaces by underscores in topic/forum titles. Usually there are a lot of words which are not useful regarding SEO terms, for example 'are', 'and', 'you', 'this' etc. All these words should be preferably cut off. In non-English topics your method will not work at all.

Further, it is not enough to just modify bb_func_vforum.php and bb_func_vtopic.php. There is a lot of places where miniBB should redirect to the proper URL, like after posting a message, searching, deleting, editing etc., not counting the add-ons.

So I would say your method completes the task on about 20% only or even less.

Author joseph38
Registered
#54 | Posted: 15 Apr 2008 06:40 | Edited by: joseph38 
Paul,

you mention the URLS which would have to be changed in the add-ons, in the search pages, and other pages, and words removed..... With just the changes I've done above the dynamic URLs continue to work fine, however. So changing the search URLs which result is not required unless one wants to create a completely search-engine friendly site. I am happy to rewrite my most common reference material section which does not change very often, and will leave a complete rewrite up to that person. I'm not interested in remaking your software .

It was however necessary to add the new topics and forums to the rewrite map files when they are changed . So taking the code above from bb_func_ptopic.php above and making it into the following function

function update_rewrite_txt($topic_title) {
global $db_mysql;
$f=fopen('/var/myowndictionary/current/rewrite_topic.txt',"a");
fwrite($f,"\n" . str_replace(' ','_',$topic_title)."\t". mod_queryOne($db_mysql,"select max(topic_id) from mb_topics")."\n");
fclose($f);
}

you can call the function from bb_func_editmsg.php when the topic title has been changed.

Amazingly, without urlencoding anything anywhere, just using plain text (my database tables and databases and my website are in UTF-8 encoding as it's a Korean site) .... the url redirection does work with non-ASCII characters in the forum and topic titles. My site is not broken !! However, an ugly side-effect is that non-ASCII stuff in the topic or forum name when it appears in the URL in the address bar (where you type the address in) ----- in MSIE it comes out looking just fine, but Firefox shows the URL as being all percent signs and numbers/letters which can be unreadable in firefox. The problem is browser's which do not allow for non-ASCII URLS as for example domain names in KOrean or Chinese.

A bad thing is that the rewrite_topic.txt and rewrite_forum.txt files are re-read on every page request. This is good for instant updating, but as you know system intensive in many ways. I may just move all my rules into my httpd.conf to prevent this problem.

So I would say that it works in 75% of the cases without breaking compatibility .

Have a wonderful day, Paul. Good luck to you and thank you for the software.

Author Paul
Lead Developer
#55 | Posted: 15 Apr 2008 10:30 | Edited by: Paul 
joseph38:
With just the changes I've done above the dynamic URLs continue to work fine, however.

I suspect if you apply dynamic URLs, they should appear everywhere. Else it could lead to duplicate content issues from the search crawlers etc. So it will appear you create SEO urls and destroy the other side.

Anyway if it works for you on 75% and you think it is good in all aspects, I have nothing to argue ;-) But I still think it's not as easy solution as you suggest, most probably I am always releasing something only if it works in all aspects, on 100% (or if it doesn't work for some reason it could be fixed easily).

Page  Page 4 of 4:  « Previous  1  2  3  4 
The Other miniBB Support Forums / The Other / Even more Search Engine friendly mod_rewrite Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB