Wednesday, December 12, 2012

Redirecting Any URL In Your Blog, To Another URL In Your Blog

Several months ago, Blogger Engineering gave us a new Blogger feature - the ability to redirect any URL in a blog, to any other URL in the blog. Like any feature, we found an immediate use for it - something much requested, for a good while.

Other people have found more uses for the redirection feature - and still others have found confusion. The syntax used in the redirection "From" and "To" values is not always obvious - and occasionally there is confusion about what can - and can't - be done with redirection.

This is the URL of this post.
http://blogging.nitecruzr.net/2012/12/redirecting-any-url-in-your-blog-to.html

Using the redirection feature, I can redirect another URL in this blog, to this post - or conversely, I can redirect the URL of this post to another URL, in this blog.

Both the "From" and "To" values in "Custom Redirects" accept any static blog URL, less the base URL of that blog. You cannot specify the base URL - so all redirections will be within the blog itself. You also cannot use a dynamic URL (containing a "?") in a redirect.

The initial use for the redirection feature (at least, for me) was to replace the Home page of the blog, with another page or post - possibly, this post.
From: /
To: /2012/12/redirecting-any-url-in-your-blog-to.html

I could change the Home page of this blog, to start all new readers on the Topics Index page.
From: /
To: /p/topics.html

If I was to change the Title of this post, when re published, the URL would not change. If I wanted to change the URL of this post, I could redirect the desired URL, to the actual URL.
From: /2012/12/redirecting-any-urls-in-your-blog.html
To: /2012/12/redirecting-any-url-in-your-blog-to.html

If I want to allow this post to be accessed from a shorter URL, I can do that. If you click on the shorter URL (below), you will note that you still see the longer URL in the browser address window!
From: /redirecting-any-url-in-your-blog-to.html
To: /2012/12/redirecting-any-url-in-your-blog-to.html


I recently created a shortcut to my Topics index, as "blogging.nitecruzr.net/topics".
From: /topics
To: /p/topics.html

To get the "From" and "To" values for any redirection, I simply take any two URLs in the same blog. Choose any two examples - one for "From", the other for "To".
  • The Home page: http://blogging.nitecruzr.net/
  • A post: http://blogging.nitecruzr.net/2012/12/redirecting-any-url-in-your-blog-to.html
  • A static page: http://blogging.nitecruzr.net/p/topics.html
  • A label search: http://blogging.nitecruzr.net/search/label/Redirecting
  • A shortcut URL: http://blogging.nitecruzr.net/topics

And drop the base URL: http://blogging.nitecruzr.net

Giving:
  • The Home page: /
  • A post: /2012/12/redirecting-any-url-in-your-blog-to.html
  • A static page: /p/topics.html
  • A label search: /search/label/Redirecting
  • A shortcut URL: /topics

Having developed the proper "From" and "To" values, adding a "Custom Redirects" entry is simple enough.

Having setup a useful complement of Pages, and redirected the Home page, you may wish to remove the "Home" page tab. Just edit the Pages gadget, using the dashboard Layout wizard, or the on blog quick edit icon - not the dashboard Pages wizard - and de select the "Home" page.

A simple example, showing the result, may be seen in my demonstration blog, Home Page Redirected To Label Search.
From: /
To: /search/label/Home%20Page

You may also wish to remove the "Showing posts with label ..." notice, if you like a cleaner display. In my demonstration blog (mentioned above), I did not do this - to make my examples more obvious.

The possibilities here are endless. Just use common sense - and again, note the limits on redirection.

Click here, for instructions. Note again, that the actual address, displayed in the browser address window, will not change.

>> Top

5 comments:

Mack McGill said...

I'm wondering how to redirect to a new url, outside of the blog.. this is what I want to do:

From: blog.example.com/p/page.html
To: www.newexample.com/page.html

The custom redirect option on Blogger only lets you redirect to another url inside the site. Any help you could provide for this would be great, thank you!

Chuck Croll said...

Mack,

You can't redirect "blog.example.com/p/page.html" to "www.newexample.com/page.html". Thanks to spammers, that option is not available.

http://blogging.nitecruzr.net/2012/11/redirecting-traffic-from-your-blogger.html

Streambank Design said...

I have to tell you - this blog just saved my life in terms of making it exactly the way I wanted it set up. You have, in one place, saved me so many hours of searching and trying to figure this out. HUGE THANKS. Every piece of info I took from here worked like a charm. SUPER APPRECIATED!

Little Ms. O+P said...

Hi Chuck!
I am so happy I found your blog!!!

But now I am in the weeds... trying to fix up my blog. I followed your instructions so when you go to my blog website you are redirected to a static page..."welcome to our website" This worked perfect....

I have several pages and I would like the blog posts to be one of them... so I can still blog on the site but the "Home Page" is redirected to a static still.

I think I am not understanding your instructions! HELP!!!

Chuck Croll said...

O+P,

Publish the blog posts using the "blog" label. Then, add a dynamic page, which references the search URL for the "blog" label.

http://blogging.nitecruzr.net/2012/05/blogger-magic-publish-posts-to-pages.html