PDA

View Full Version : SEO mods for NBS -MF Script.


mmlug
06-22-2006, 08:34 AM
Hello,

Can i do some code change for SEO mods.??
Would be working with latest NBS MF Script???

Simple mod rewrite.


.htaccess
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} /viewforum([0-9]*)-([0-9]*)-s([0-9]*).html
RewriteRule (.*) /viewforum.php?f=%1&topicdays=%2&start=%3 [L]

RewriteCond %{REQUEST_FILENAME} /forum([0-9]*).html
RewriteRule (.*) /viewforum.php?f=%1 [L]

RewriteCond %{REQUEST_FILENAME} /forum([0-9]*)-s([0-9]*).html
RewriteRule (.*) /viewforum.php?f=%1&start=%2 [L]

RewriteCond %{REQUEST_FILENAME} /ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-s([0-9]*).html
RewriteRule (.*) /viewtopic.php?t=%1&postdays=%2&postorder=%3&start=%4 [L]

RewriteCond %{REQUEST_FILENAME} /ftopic([0-9]*)-s([0-9]*).html
RewriteRule (.*) /viewtopic.php?t=%1&start=%2 [L]

RewriteCond %{REQUEST_FILENAME} /ftopic([0-9]*).html
RewriteRule (.*) /viewtopic.php?t=%1 [L]

RewriteCond %{REQUEST_FILENAME} /ftopic([0-9]*).html
RewriteRule (.*) /viewtopic.php?t=%1&start=%2&postdays=%3&postorder=%4&highlight=%5 [L]



Search in /includes/sessions.php

function append_sid($url, $non_html_amp = false)
{
global $SID;


Replace with

function append_sid($url, $non_html_amp = false)
{

global $SID,$HTTP_SERVER_VARS,$db,$board_config;
if( strstr($url,'viewtopic.php') && !strstr($url,'viewtopic.php?replace') )
{
if(ereg("#",$url)) {
$pos=strpos($url, "#");
$url_temp=substr($url,0,$pos);
$zusatz=substr($url,$pos,strlen($url));
$url=$url_temp;
}
}

//
//Post
//
if( strstr ($url, 'viewtopic.php?p=') ) {
$prg=str_replace("viewtopic.php?","",$url);
parse_str($prg, $prg_output);

$sql = "SELECT topic_id
FROM " . POSTS_TABLE . "
WHERE post_id = '".$prg_output['p']."'";
if ($result = $db->sql_query($sql)) {
$row = $db->sql_fetchrow($result);
$prg_output['t'] = $row['topic_id'];
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE post_id < '".$prg_output['p']."'
AND topic_id = '".$prg_output['t']."'";
if ($result = $db->sql_query($sql)) {
$c = $db->sql_numrows($result)+1;
if ($board_config['posts_per_page'] < $c)
$prg_output['start'] = floor(($c-1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}
if (isset($prg_output['start']))
$url = preg_replace('#viewtopic.php\?p='.$prg_output['p'].'#','ftopic'.$prg_output['t'].'-s'.$prg_output['start'].'.html',$url);
else
$url = preg_replace('#viewtopic.php\?p='.$prg_output['p'].'#','ftopic'.$prg_output['t'].'.html',$url);
unset($prg_output['p']);
}
}

//
// Topic
//
if( strstr ($url, 'viewtopic.php?t=') ) {
$prg=str_replace("viewtopic.php?","",$url);
parse_str($prg, $prg_output);
$start= preg_match('#start=0#', $url);
$topicdays = preg_match( '#postdays=0#', $url);
$mark = preg_match( '#mark#', $url);
$postorder = preg_match( '#postorder=asc#', $url);
$highlight = preg_match( '#highlight#', $url) || preg_match( '#vote#', $url) || preg_match( '#newest#', $url);
if (!$highlight) {
if ($postorder ) {
$url = str_replace( 'postorder=asc', '', $url );
}
if ($start) {
$url = str_replace( 'start=0', '', $url );
}
if ($topicdays) {
$url = str_replace( 'postdays=0', '', $url );
}
if (!($mark)) {
$url = str_replace( 'viewtopic.php?t=', '', $url );
$url1 = strtr($url,array("view=newest"=>"", "./"=>"", "?t="=>"", "amp;"=>"", "postorder="=>"p-", "&"=>"", "start="=>"-s", "topicdays="=>"-"));
$url = "ftopic".$url1. ".html";
}
}
}

//
// Forum
//
if( strstr ($url, 'viewforum.php?f=') ) {
$prg=str_replace("viewforum.php?","",$url);
parse_str($prg, $prg_output);
$start= preg_match('#start=0#', $url);
$topicdays = preg_match( '#topicdays=0#', $url);
$mark = preg_match( '#mark#', $url);

if ($start) {
$url = str_replace( 'start=0', '', $url );
}
if ($topicdays) {
$url = str_replace( 'topicdays=0', '', $url );
}
if (!($mark)) {
$url = str_replace( 'viewforum.php?f=', '', $url );
$url1 = strtr($url,array("./"=>"", "?f="=>"","amp;"=>"","&"=>"","start="=>"-s","topicdays="=>"-"));
$url = "forum".$url1. ".html";
}
}



Open viewtopic.php and Search...

'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"),


Replace with..

U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"),


Would be working with latest NBS MF Script???

mmlug.

Derek
06-22-2006, 12:54 PM
Should work. Just give it a try and see. I don't see why it wouldn't though.

Derek

mmlug
06-23-2006, 07:57 AM
Ok, I will test it.

Is there any better idea for SEO?? And we need really better URL(SEO) for Forum??

regards,
mmlug.

Derek
06-23-2006, 12:03 PM
Not sure, I don't know much about SEO.

Sorry.

Derek

ForumZCLub
06-27-2006, 10:38 AM
Best Idea would be to add up Meta Tag Generator Mod into your Forum .
Also Static HTML is a very gud idea!

mmlug
06-28-2006, 07:51 AM
this mod will only support for

domain.com/forum/viewtopic.php?t=1

to

domain.com/forum//ftopic1.html

reagrds,
mmlug.

ForumZCLub
09-02-2006, 12:32 PM
This wont work

ForumZCLub
09-03-2006, 01:50 PM
Ok I checked it and It doesnt works
Really would be in problem

luky
09-20-2006, 05:53 AM
Search engine optimization? Couldnt you insert META tags into the header files?

Derek
09-20-2006, 06:46 AM
He means make search engine friendly URLs, since search engines don't really like .php extensions, and tend not to crawl those too well.

Derek

luky
09-20-2006, 09:25 AM
Oh okay, but still what i said does help dramaticly. Also robots.txt is n awesome help!