Permanent Google Love

permanent, permanenter, permanentest

Proper SEO takes proper attention.
And this attention is often given - it pays.

Proper SEO attempts also lead me repeatedly answering a single question: In several places within Liferay, a "302" temporary redirect is generated. And google doesn't like seeing temporary redirects forever. They strongly prefer "301" permanent redirects.

Why does Liferay generate 302 redirects?

I don't know the exact reason why Liferay doesn't generate 301 by default, but I know that I've been bitten by 301s a couple of times. For that reason I'm really happy that Liferay defaults to temporary redirects. There are arguments that the choice between temporary and permanent redirection should be made available - but there are also some counterarguments. Read on (a solution follows the explanation)

Do you (Olaf) not care for SEO?

I do care for SEO, but I care more for user experience: 301 is an offense weapon. Once you've used it, you've made absolutely and certainly clear that this wasn't a (temporary) warning, but a permanent order. Any decision afterwards, any means to roll back your configuration, might fail for anyone who has already seen it. Thus 301 should not be generated lightly: Permanent redirects may be cached permanently (as in "forever"). There simply is no "Try again tomorrow to see what exactly we meant when we said permanent". Whether it's "somewhat permanent", "permanent", "permanenter" or "permanentest" is the decision of the client (i.e. a browser, or google). Not yours!

So?

An example:

When business travel was still en vogue, I've stayed in a hotel close to the office. The hotel had some unregistered firewall in its infrastructure, that intercepted http traffic from time to time, and redirected it to its own registration page. The redirect was issued via 301, permanent redirect. This (wrong) use of a redirect caused all kinds of havoc: A colleague's browser cached it for one of the few http-bookmarks she used for an external site - even outside of the hotel. My own podcast client updated all the http-RSS-feed URLs (yes, some weren't on https) to the new target of the permanent redirection. Thus, after visiting that hotel, a number of my podcast updates reacted with error message: The firewall's registration page was not a valid RSS feed. And the original RSS feed URLs were permanently lost.

The firewall vendor's suggestion "just clear your cache" naturally didn't work. It's been a while since I've visited that hotel, but I assume that many other guests before and after me spent countless hours trying to fix their computers, feeds and other infrastructure, without a clue of what happened.

But I still need those 301 redirects!

Sure. You may have them. Just be aware that they shouldn't be generated lightly, and not at all by default. "Google likes them better" is not a reason to generate 301. "I'm absolutely positively permanently sure that this one is valid next year and will fight for it in arguments with my peers" is a reason.

My recommendation is to generate them in your reverse proxy (you use one, right?). This isn't very admin-friendly, granted. But it makes sure that any permanent redirect will be inspected, questioned, and have a reason. If you're using Apache httpd, this might end up as a number of lines like this:

Redirect permanent /mylandingpage1 "https://www.example.com/web/guest/blog/-/blogs/welcome"
Redirect permanent /mylandingpage2 "https://www.example.com/web/guest/an-offer-you-cant-refuse"

And while you can't use your mouse to select between 301 and 302: Even an endless scroll of those lines will be trivial to administer, fast to execute, and happily protect you from abuse of a hazardous redirection codes. Editing that config file with a proper text editor will even provide more overview over the actual redirects on your site.

I'm sure, you know when to use 301 vs 302. Save yourself from that other author on your team who has read somewhere that "you should always use 301, never 302". Because you shouldn't. You should only do so when it matters.

Illustration for this article: Licensed  "CC by-sa", Tom Woodward.

Blogs

If you comment on this article, please indicate if you've ever read a document named *********-FINAL-2.doc ...

 

(which somehow illustrates the same problem)

I can't agree more.  I feel you. Been there, done that.

I also remember a long discussion with a SEO expert that it would be better if deleted pages were to return 410 GONE instead of 404 a while ago (Actually, it probably doesn't matter at all). SEO can be fun.