Back to vBulletin 3.6 Add-ons

Enforce www preference in URL
Mod Version: 1.00, by jcodemasters

This modification is in the archives.
vB Version: 3.6.4 Rating: (0 vote - 0 average) Installs: 3
Released: 01 Oct 2008 Last Update: Never Downloads: 21
Not Supported Code Changes Is in Beta Stage  

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");

PHP Code:
$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: [url]http://'[/url] . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
exit();
} elseif ( 
strpos($_SERVER['HTTP_HOST'], 'www.') !== && strpos($web_home'http://www.') === ) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: [url]http://www[/url].' $_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

Download

This modification is archived, downloads are still allowed.

File Type: %1$s WWW.txt (859 Bytes, 22 downloads)


vblts.ru supports vBulletin®, 2022-2025