How to Automatically Redirect to a New URL | HTML Tutorial

This is a tutorial on how to make your old Tumblr url to redirect to your new url – including all your old posts.

Update: It’s been a while since I created this tutorial, and tumblr has changed a lot in the meantime. The original code I provided in this tutorial no longer works. Lucky for you, I’ve created an updated sample, so you can still create a redirect!

When you change your url on tumblr, all links to your old blog will no longer work, and people might not be able to find you. Setting up a tumblr with your old allows you to create a browser redirect, so people visiting a link to your

When you have changed your url, make a new secondary blog with your old url.

  1. Go to ‘customize’ on that blog.
  2. Go to ‘Edit HTML’.
  3. Delete EVERYTHING
image

Note: If you for any reason regret the changes you’ve made to your theme, Tumblr keeps back ups for a while. You can find backups of your blog here.

 Copy and paste this code into your html:

<! DOCTYPE html>
<html>
<head>
<script type="text/javascript">
if (location.host == 'OLDURL.tumblr.com')
location.replace(location.href.replace('OLDURL.tumblr.com', 'NEWURL.tumblr.com' ));
</script>
</head>
<body>
<a href="http://NEWURL.tumblr.com">NEW URL: OLDURL is now NEWURL</a>
</body>
</html>
  • Replace ’NEWURL’ with the url of your primary blog (the one you want to redirect viewers to).
  • Replace ’OLDURL’ with the url of your secondary blog, the one you are editing right now (the one you want redirect readers away from).

When people visit your old url they will now automatically be redirected to your new url.

Example: I used to be FitAnne but if you click the link you will end up at my new url, Annesmiles.

Please note that while you’re editing the HTML of  your theme, after updating the preview and saving the code, the preview will not redirect.

Instead, it will look like this:

To see if the redirect is working, go the URL in your browser, after saving your changes.

Using this code snippet allows you to redirect oldurl.tumblr.com/whatever to newurl.tumblr.com/whatever instead of just newurl.tumblr.com. That way people looking for a specific post on your old blog will redirected straight to it rather than the main page of your new url. Now you don’t have to worry about updating old links!


Note: Some people experience an error when they try to save the code. It’s usually because the quotation marks sometimes don’t copy-paste the right way, so you might need to rewrite them yourself (use ctrl+f to replace all at once).

Message me if you need help with this tutorial, or have a request for another.

If you found this tutorial helpful, you can reblog it here

Gif that says lots of love, Anne xx


For “the record” here’s the original code provided, which no longer works:

<script language="javascript">

location.replace("http://NEWURL.tumblr.com");

</script>

<meta http-equiv="refresh" content="7; url=http://OLDURL.tumblr.com">

<a href="http://NEWURL.tumblr.com"><font face="arial,helvetica">NEW URL!</font></a>