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.
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.