jcodemasters
09-30-2008, 10:00 PM
Hello,
After an year I finally got some time to look at my poor board which is losing page rank in every google update. I am currently optimizing my forum, while doing this i found there was duplicate content issue in my forum. See this example
http://myvbforum.com Page rank 0
http://www.myvbforum.com Page rank 2
http://www.myvbforum.com/index.php Page rank 1
You can see from above urls all have same contents but different page rank also Google consider them different urls and those cause the duplicate contents problem.
In order to avoid duplicate contents issue you should add following code to your config.php on second line below this ini_set("max_execution_time", "240");
$web_home = 'http://www.REPLACE_WITH_YOUR_FORUM_URL.com';
if ( $_SERVER['REQUEST_URI'] == str_replace('http://' . $_SERVER['HTTP_HOST'], '', $web_home) . '/index.php' ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $web_home . '/');
exit();
}
if ( strpos($_SERVER['HTTP_HOST'], 'www.') === 0 && strpos($web_home, 'http://www.') === false ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://' . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
exit();
} elseif ( strpos($_SERVER['HTTP_HOST'], 'www.') !== 0 && strpos($web_home, 'http://www.') === 0 ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
I have tested it in VB 3.6.4 and it works fine. I am not VB expert this could be a plugin, if you can make it then please upload here.
Have Fun
After an year I finally got some time to look at my poor board which is losing page rank in every google update. I am currently optimizing my forum, while doing this i found there was duplicate content issue in my forum. See this example
http://myvbforum.com Page rank 0
http://www.myvbforum.com Page rank 2
http://www.myvbforum.com/index.php Page rank 1
You can see from above urls all have same contents but different page rank also Google consider them different urls and those cause the duplicate contents problem.
In order to avoid duplicate contents issue you should add following code to your config.php on second line below this ini_set("max_execution_time", "240");
$web_home = 'http://www.REPLACE_WITH_YOUR_FORUM_URL.com';
if ( $_SERVER['REQUEST_URI'] == str_replace('http://' . $_SERVER['HTTP_HOST'], '', $web_home) . '/index.php' ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $web_home . '/');
exit();
}
if ( strpos($_SERVER['HTTP_HOST'], 'www.') === 0 && strpos($web_home, 'http://www.') === false ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://' . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
exit();
} elseif ( strpos($_SERVER['HTTP_HOST'], 'www.') !== 0 && strpos($web_home, 'http://www.') === 0 ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
I have tested it in VB 3.6.4 and it works fine. I am not VB expert this could be a plugin, if you can make it then please upload here.
Have Fun