Changeset 480939
- Timestamp:
- 12/27/2011 05:58:32 AM (14 years ago)
- Location:
- seo-blogger-to-wordpress-301-redirector/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
seo-blogger-to-wordpress.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
seo-blogger-to-wordpress-301-redirector/trunk/readme.txt
r480827 r480939 5 5 Requires at least: 2.6 6 6 Tested up to: 3.3 7 Stable tag: 0.3. 57 Stable tag: 0.3.6 8 8 9 9 This plugin will 301 redirect all incoming traffic from your Blogger account to your newly setup Wordpress account. Move from Blogger to wordpress with great ease. … … 68 68 == Upgrade Notice == 69 69 70 = 0.3. 5=71 Redirects for Archive and Label Pages 70 = 0.3.6 = 71 Bug Fix from last night's update. -
seo-blogger-to-wordpress-301-redirector/trunk/seo-blogger-to-wordpress.php
r480827 r480939 4 4 Plugin URI: http://suhastech.com/seo-blogger-to-wordpress 5 5 Description: This plugin will 301 redirect all incoming traffic from your Blogger account to your newly setup Wordpress account. Please read the documentation at suhastech.com/seo-blogger-to-wordpress before you continue. 6 Version: 0.3. 56 Version: 0.3.6 7 7 Author: Suhas Sharma 8 8 Author URI: http://suhastech.com … … 388 388 function suhas_blogger() { 389 389 global $wpdb; 390 if ( !is_404() && !preg_match("/blogspot.com/i",$_SERVER['HTTP_REFERER']))390 if ( !is_404() ) 391 391 return; 392 $subdirectory = explode ("/", get_home_url()); 393 $req_uri = str_replace("/".end($subdirectory), "", $_SERVER['REQUEST_URI']);392 393 $req_uri = $_SERVER['REQUEST_URI']; 394 394 $url = explode("?", $req_uri); 395 395 $res = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink' AND meta_value = '$url[0]'"); … … 398 398 wp_redirect(get_permalink($res[0]->post_id), 301 ); 399 399 } 400 else if (preg_match("/blogspot.com/i",$_SERVER['HTTP_REFERER'])) { 401 402 $process = explode("blogspot.com", $_SERVER['HTTP_REFERER']); 403 $exp = explode("/",$process[1]); 404 405 if (preg_match("/archive.html/i",$exp[1])) 406 { 407 $archive = explode("_",$exp[1]); 408 ?> 400 else 401 { 402 return; 403 } 404 exit(); 405 } 406 407 function suhas_blogspot() { 408 global $wpdb; 409 $old_url = $_GET['blogger']; 410 411 if ($old_url != "") { 412 413 $permalink = explode("blogspot.com", $old_url); 414 $url = explode("?", $permalink[1]); 415 $res = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink' AND meta_value = '$url[0]'"); 416 if(isset($res[0]->post_id)) 417 { 418 wp_redirect(get_permalink($res[0]->post_id), 301 ); 419 } 420 else { 421 return; 422 } 423 424 } 425 exit(); 426 } 427 428 function suhas_blogspot_archive() { 429 if ( !is_home()) 430 return; 431 $process = explode("blogspot.com", $_SERVER['HTTP_REFERER']); 432 $exp = explode("/",$process[1]); 433 434 if (preg_match("/archive.html/i",$exp[1])) 435 { 436 $archive = explode("_",$exp[1]); 437 ?> 409 438 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 410 439 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" … … 423 452 </body> 424 453 </html> 425 <?php426 // Yup, this is supposed to be SEO unfriendly, else your homepage will be redirected to archive pages and will not be indexed.427 // This is just for real vistors.428 429 }430 else if (substr($exp[1], 0, 6) == "search")431 {432 if(!($exp[3] == ""))433 {434 435 ?>454 <?php 455 // Yup, this is supposed to be SEO unfriendly, else your homepage will be redirected to archive pages and will not be indexed. 456 // This is just for real vistors. 457 458 } 459 else if (substr($exp[1], 0, 6) == "search") 460 { 461 if(!($exp[3] == "")) 462 { 463 464 ?> 436 465 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 437 466 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" … … 450 479 </body> 451 480 </html> 452 <?php 453 454 } 455 456 } else { return; } 457 458 459 460 } 481 <?php 482 483 } 484 485 } else { return; } 486 461 487 exit(); 462 } 463 464 function suhas_blogspot() { 465 global $wpdb; 466 $old_url = $_GET['blogger']; 467 468 if ($old_url != "") { 469 470 $permalink = explode("blogspot.com", $old_url); 471 $url = explode("?", $permalink[1]); 472 $res = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink' AND meta_value = '$url[0]'"); 473 if(isset($res[0]->post_id)) 474 { 475 wp_redirect(get_permalink($res[0]->post_id), 301 ); 476 } 477 else { 478 return; 479 } 480 481 } 482 exit(); 488 489 483 490 } 484 491 … … 487 494 if ( isset( $_GET['blogger'] ) ) 488 495 add_action( 'template_redirect', 'suhas_blogspot' ); 496 if (preg_match("/blogspot.com/i",$_SERVER['HTTP_REFERER'])) 497 add_action( 'template_redirect', 'suhas_blogspot_archive' ); 489 498 ?> 499
Note: See TracChangeset
for help on using the changeset viewer.