Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

How can I implement 301 redirect for specific posts of blogger (Not all)?

share|improve this question
    
Does it have to be a 301, or can it just be any redirect? –  Gelatin Aug 26 '10 at 13:45
add comment

5 Answers

One new option has just opened up at "Settings › Search preferences" in the blogger interface:

Detailed here, it looks like:

enter image description here

Caveats

  • Doesn't appear to allow redirections outside the domain
  • Not clear what the mechanism of redirection is in an HTTP sense (although it should be easy to find out)

Update: It seems you may now be able to specify a "permanent" redirect and i have updated the image to show this...

share|improve this answer
1  
Some time ago Blogger introduced a new checkbox to specify whether the redirect is "Permanent" or not. –  Salman A Apr 12 '13 at 8:26
add comment

I'm pretty sure this can't be done. Your only opition would be a JavaScript redirect which could have text such as:

The url for this post has changed to http://example.com/post123. Please update your bookmark. You will be redirected to this page in 10 seconds.

I have even seen companies like Microsoft utilize these kind of pages.

Update: I just ran into an example of Apple using a page like this.

share|improve this answer
add comment

Complete answer

(From a post by Khusnul Khotimah, to which I've added my own observations)

Suppose you have a blog with three posts at addresses OldPostURL-A, OldPostURL-B, and OldPostURL-C, which you want to redirect to NewPostURL-A, NewPostURL-B, and NewPostURL-C, respectively, with a delay of 2 seconds. Then you need to insert the following code in your template immediately after the <head> tag:

<b:if cond='data:blog.url == "OldPostURL-A"'>
<meta http-equiv="refresh" content="2; url=NewPostURL-A" />
</b:if>

<b:if cond='data:blog.url == "OldPostURL-B"'>
<meta http-equiv="refresh" content="2; url=NewPostURL-B" />
</b:if>

<b:if cond='data:blog.url == "OldPostURL-C"'>
<meta http-equiv="refresh" content="2; url=NewPostURL-C" />
</b:if>

The new URLs may be inside or outside your blog.

N.B: This works if the blog from which you are redirecting uses "layouts", but not if it uses the older "classic" templates. It seems that "classic" Blogger doesn't understand the "b:if" tag and therefore ignores it, with the result that the "cond" is always treated as true. Hence, if you try to use a series of conditional redirects in a "classic" template, the URL given in the last redirect will apply, and all pages on your blog will redirect to that URL (oops!). You can modify this behavior by exploiting the fact that "classic" Blogger respects the <ItemPage> tag in the <head>. But that doesn't solve the problem if you have more than one item page to redirect; you need to "upgrade" the template to a "layout".

Yes, the redirection code really must be inserted immediately after the <head> tag. Any other code in between can stop the redirection code from working - even if you think you've made sure that the redirection code isn't inside a comment!

I've used this trick (with a 1-second delay) for redirected posts at this old blog (if a post has been moved, clicking on its title starts the automatic redirection).

share|improve this answer
add comment

Rumor has it that some search engines, including Google, will treat a "meta refresh" the same as 301 redirect, if the specified refresh delay is short. A meta refresh could be implement as the last resort when no other redirection option is available.

A meta refresh looks like this:

<meta content='0;url=http://newblog.blogspot.com/post.html' http-equiv='refresh'/>

In order for search engines to consider this meta tag into account:

  1. this tag must go inside the <head> section
  2. the delay should be small, 0-5 seconds

In blogger you can edit the head section of your blog via "Templates > Edit HTML". Blogger also provides the possibility of little bit of server-side scripting. So you can inject the meta refresh in the head section of your blog CONDITIONALLY, e.g. only when the page URL is http://oldblog.blogspot.com/post.html.

This post shows you how you can inject a custom title tag by checking the value of a blogger variable called data:blog.pageName. Likewise, you can inject a custom meta tag by checking the URL of requested page using the blogger conditional b:if and blogger template variable data:blog.url:

<b:if cond='data:blog.url == &quot;http://oldblog.blogspot.com/post.html&quot;'>
<meta content='0;url=http://newblog.blogspot.com/post.html' http-equiv='refresh'/>
</b:if>

Complete reference of blogger template variables is available here.

Edit:

I applied this on my blog and it kind of worked actually. Google webmaster tools reports links to my old blog in my new blog's "Links to Your Site" section.

share|improve this answer
    
What is the source for "Rumor has it..."? –  Elijah Lynn Aug 19 '13 at 22:22
add comment

I don't think there's a straightforward feature provided by Blogger to do this. However, if your Blogger-powered blog is on a custom domain (NOT something.blogspot.com) then there is an indirect way to do this (caveat: Highly experimental. May be correct in theory, but hasn't been tried in practice)

  1. Set up a web-server where you you have adequate control over it's configuration.
  2. Change the customer domain DNS settings to point to the IP address where your web-server is listening.
  3. Set-up a reverse-proxy between your IP address and the IP-addresses provided by Google for Blogger blogs. Now all your blog traffic will be proxied through a web-server that's under your control
  4. Change your web-server config to perform a 301-redirect for select URLs as required.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.