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.

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

Copy and paste this code into your html:


<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>

Replace ’NEWURL’ (two places) with the url of your primary blog (the site you want to redirect viewers to).

Replace ’OLDURL’ (one place) with the url of your secondary blog, the one you are editing right now.

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

Example: I used to be A-Million-Steps but if you click the link you will end up at my new url, Fitanne.

image

Update

Using the code below allows you to redirect oldurl.tumblr.com/something to newurl.tumblr.com/something instead of just newurl.tumblr.com – that way you don’t need to worry about updating old links!


<! 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>

Note: Some people experience an error when they try to save the code. It’s because the ” doesn’t always copy 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