Skip to content

Instantly share code, notes, and snippets.

@vanpariyar
Last active October 21, 2022 09:36
Show Gist options
  • Save vanpariyar/704b678f4b4cc538ae0383a12ef2f985 to your computer and use it in GitHub Desktop.
Save vanpariyar/704b678f4b4cc538ae0383a12ef2f985 to your computer and use it in GitHub Desktop.
How to redirect blogger to wordpress

Note: before doing this please import your blog to the wordpress 😄

  1. Switch the theme to classic
  2. select option for the backup and change
  3. change the code give below and pastes in the HTML editor
<html>
	<head>
		<title>Redirecting... BLOGNAME</title>
		<script>
          	var url = "{NEW BLOG URL}/";
          	var str = window.location.href.split('?')[0];
			var res = str.split("blogspot.com/");
          	if( null != res[1] ) {
                var restPart = res[1].split(".");
                
              	if( null != restPart[0] ) {
	            	url = url+restPart[0];
                }else {
                  	url = url+res[1];
                }
            }
			<MainOrArchivePage> window.location.href="{NEW BLOG URL}/"; </MainOrArchivePage>
			<Blogger>
				<ItemPage>
				 window.location.href=url;
				</ItemPage>
			</Blogger>
		</script>
		<MainPage>
			<link rel="canonical" href="{NEW BLOG URL}/" />
		</MainPage>
		<Blogger>
			<ItemPage>
				<link rel="canonical" href="{NEW BLOG URL}/" />
			</ItemPage>
		</Blogger>
	</head>
	<body>
	</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment