Community Forums › Forums › Archived Forums › Design Tips and Tricks › Need Help Redirecting Old Blog to New Site
Tagged: Redirecting Blog
- This topic has 6 replies, 2 voices, and was last updated 8 years, 4 months ago by Brad Dalton.
-
AuthorPosts
-
December 3, 2015 at 1:49 am #172567Catherine86Member
Hi. I've recently switched my blog from blogger to WordPress, and I've also got a new domain name for the blog.
I initially asked Copyblogger Media Support, and they directed me to this http://www.wpbeginner.com/wp-tutorials/how-to-switch-from-blogger-to-wordpress-without-losing-google-rankings/
I've worked through this tutorial and have successfully transferred the content of my blog over. However, I'm getting stuck at step 4. Here are my questions:
1) When it says "replace http://www.example.com" with your own domain name, does it always mean your new domain name (in this case http://www.catherineshelton.net) or your old domain name (in my case http://www.gracetoabide.com)?
2) For the next step, where it tells you to paste some code into your WordPress themes functions.php file, do I do that by going to Dashboard>Appearance>Edit CSS ?
I'm a bit of a novice at all of this, so please use simple directions in your replies! Thank you!
http://www.catherineshelton.netDecember 3, 2015 at 3:17 am #172568Brad DaltonParticipant1. New
2. No. Use FTP or File Manager in cpanel to access your child themes functions.php file and add the code at the end of the file. Use a code editor if using FTP.
December 3, 2015 at 5:31 am #172587Catherine86MemberThanks Brad. Just a question about no.1:
In that case, if I've pasted in the new code correctly on blogger, doesn't that mean that if someone types in my old blog domain into a search engine they will end up at my new blog domain? When I type it in I just get a confused page of numbers on my old domain.
December 3, 2015 at 6:55 am #172590Brad DaltonParticipant1. Replace http://www.example.com with your new domain name in the blogger code.
2. Add the following code to the end of your child themes functions file:
function blogger_query_vars_filter( $vars ) { $vars[] = "blogger"; return $vars; } add_filter('query_vars', 'blogger_query_vars_filter'); function blogger_template_redirect() { global $wp_query; $blogger = $wp_query->query_vars['blogger']; if ( isset ( $blogger ) ) { wp_redirect( get_wordpress_url ( $blogger ) , 301 ); exit; } } add_action( 'template_redirect', 'blogger_template_redirect' ); function get_wordpress_url($blogger) { if ( preg_match('@^(?:https?://)?([^/]+)(.*)@i', $blogger, $url_parts) ) { $query = new WP_Query ( array ( "meta_key" => "blogger_permalink", "meta_value" => $url_parts[2] ) ); if ($query->have_posts()) { $query->the_post(); $url = get_permalink(); } wp_reset_postdata(); } return $url ? $url : home_url(); }
December 3, 2015 at 3:33 pm #172638Catherine86MemberHi Brad. Thank you. However, I've done all that and it's still not working. Was I supposed to paste exactly what you wrote above (which I did) or also add <?php to the beginning and ?> to the end, like one of the tutorials suggested? What have I done wrong?
December 3, 2015 at 3:45 pm #172640Catherine86MemberI'm wondering if it's got something to do with the fact that I have 2 blogs on my wordpress account. The other one is http://www.livinggreenfaith.com. When I add the code to the functions.php file in (what I'm sure is) my http://www.catherineshelton.net site, then mysteriously the content on http://www.livinggreenfaith.com is no longer visible.
December 3, 2015 at 7:47 pm #172665Brad DaltonParticipantNot sure. Would need to go through the entire process to find out. I have done this myself many years ago and it seems fairly straight forward.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.