• Welcome to Simple Machines Community Forum. Please login or sign up.
October 18, 2021, 06:56:16 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


[2.0.x] Redirection boards should use 301 redirect, not 302, for better SEO

Started by badon, May 02, 2016, 06:19:20 AM

Previous topic - Next topic

badon

In SMF 2.0.11, a redirection board can be created that has link keyword text of "Best Forum Software", with an URL like this:

https://someforum.com/index.php?board=999.0

When the user clicks that URL, it could go to any URL of the admin's choosing, perhaps one like this:

http://www.simplemachines.org/

The problem is SMF uses a 302 redirect, which indicates to search engines that eventually simplemachines.org's content will be found at "board=999.0", which is not the case. The odds of ANY redirect board being converted into an actual content board is close to 0. I can't think of any circumstance where a 302 redirect would be appropriate for a redirect board that points to external URL's.

For internal URL's, a 302 would only be correct if someone is doing bizarre surgery on their forum and they really want to convert boards to redirects, and redirects to boards , and just generally keep shuffling things around repetitively, which doesn't make sense - even then, a 301 redirect would be better. If there is a use case for a 302 redirect at all, it's likely to be very rare. If the redirect type is hard-coded and can't be selected by the admin, 301 redirect should be used instead of 302.

Below are some references:

What is a 301 redirect vs a 302 redirect?
Quote
A 301 redirect is a permanent redirect. [...] All traffic intended for URL A is permanently routed to URL B, and all link popularity and existing SEO value for URL A should also be transferred to URL B. [...] A 302 redirect is a temporary redirect.

[...]

If you use a 302 redirect when you should use a 301, search engines have to try and determine which page is the "high value" page. Only one version of the page will likely be listed in search engine results, and you stand a chance of having the wrong page listed. This problem compounds over time as a chain of redirects can sometimes exist on older sites.

What is the difference between 301 and 302 redirects in SEO?
Quote
A good example of when to do a 302 redirect would be [if] you have a product that you no longer have for sale [but] is something that you might sell again. In this case, you might want to use a 302 redirect to send the user to the category page. If the product outage is going to be for any real length of time it might not make sense to send the user to a page that they cannot order from, so you redirect them to the category page allowing them to look at similar items. And with that 302 you are telling the search engine crawlers that your content is just offline temporarily [...]

I did a search for discussion of this subject, but I didn't see where anyone had reported or discussed this topic before:

http://www.simplemachines.org/community/index.php?action=search2;search=redirect+302;brd[]=147

Is there an easy workaround for this issue while we wait for the bug to fixed?

Kindred

well....maybe for you....

except we chose 302 in purpose.

So... not a bug.

However, if you want to change it in your own code  you can.
I am sure someone will be by shortly who can tell you specifically where...
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Actually this one's not on purpose. It just uses the standard redirect function internally which doesn't support adding 301 headers to anything.

Unfortunately that means 1) new functionality rather than a bug fix and 2) potential backwards compatibility breakage (you cannot force all redirects to be 301 because that will have other, nastier consequences)

Oh and while it's nice to have references for complex things, the dev team do know about and understand what 301 and 302 are, thank you.
No good deed goes unpunished
All helpful urges should be circumvented

Kindred

hmmmm.... really?  I would have assumed on purpose - 302 makes more sense for the redirect boards than 301, IMO.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Why does it make more sense? badon's right, users don't tend to convert boards back later.

And redirect exit doesn't have an option to say "use a 301 here", it's 302 or meta refresh only.
No good deed goes unpunished
All helpful urges should be circumvented

badon

I'm guessing one of the originally envisioned use cases for the redirect boards feature was the ability to "close" a board and move its contents to some other board. For example, a board named "SMF 0-day exploits" might be closed and all it's posts moved to another board called "April fool's jokes". Since many people probably linked to the "SMF 0-day exploits" board, simply deleting it would break all those links. Then, instead of deleting it, it can be converted into a redirect board that redirects to "April fool's jokes". That's a good example of a use case that is both internal (where 302 redirects make sense), and it's possible the "SMF 0-day exploits" board could be re-opened again on April Fool's Day of the next year.

That's an incredibly specific use case, and I would be surprised if anyone actually uses redirect boards that way. There might be other use cases that are just difficult to think of, due to the temporary nature of 302 redirects. Being temporary by definition means they're naturally less important than a permanent 301 redirect. And, of course, a 301 redirect can do the job of a 302 if "temporary" means "1 year". It's just very unlikely that anything important will be done (and technically should be done) with a 302 redirect, even if there is a use case for it.

It sounds like this was a design decision due to the expediency of a 302 redirect, which means it's not strictly a bug per se. Instead, this might be better described as a feature request. If so, then I guess we would have to decide if fixing this "bug" requires giving admins the choice to select 301 or 302 redirect, which might be trivial to do in comparison to simply implementing a 301.

If the feature was added to give admins the ability to choose 301 or 302, then I suggest making 301 the default, and warning against using 302 "unless you know what you're doing". I would be OK with simply doing 301 for everything, unless we can think of a use case where it would be important to have a 302. Once again, the temporary nature of 302 kind of implies it's not hugely important, so if we're going to cut corners for expediency in the implementation, that's a good place to do it, because 301 still gets the job done even for the April Fool's example use case.

I'm not sure how long search engines retain search data for temporarily moved or offline material, but I doubt it would be for more than a few months. So, we would need to think of a use case that would require converting boards to redirects, and back again, within a few months. Forum layouts tend to be pretty stable, and when they're not stable (like when they're new), there is not a lot of SEO and old backlinks to deal with.

A very large forum might care about using the right kind of temporary redirect (302) much more than a small new forum, but the bigger a forum is, the less likely it is for the layout to be frequently changed. I have to conclude that the "essential 302" use case is rare enough it may not even exist at all, even with all the SMF installations worldwide. If anybody out there really needed it, I would have found somebody pleading their case when I looked for past discussions.

I think 301, if implemented, is probably all that is needed.

Arantor

The original use case was people using it to prominently display a link to something like we used to do here for the bug tracker (maybe we now use it for GitHub?)

The problem is not whether we give admins the choice (this is largely overkill and requires database structure changes, amongst other things) but rewriting one of the most fundamental routines inside SMF to work in a way it currently does not, and in a way that has consequences. Bolting on a change like this is not a trivial matter which is why it's never been done before.

You see, the same routine is used everywhere in SMF. Literally throughout SMF. Make a post, get redirected back either to the post itself or the list of posts in a board (prevents people hitting refresh to double post by accident), there's the redirect code in action. Make literally any change to anything in the forum, boom, the redirection code in action.

I suppose it would be possible to just rewrite the board redirection only to use 301 and completely bypass the existing redirection code but that raises maintenance issues and limits to what modders can do.

This is not a simple or trivial change, no matter how you do it. As usual, changing the core is a different proposition to changing a single installation as you and I have discussed at length before.
No good deed goes unpunished
All helpful urges should be circumvented

nend

I can see the issue here, and I am probably the 1% that recycles boards.

I just can't waste a perfectly good table in the database. I worry about upper limits knowing the possibility of hitting them isn't going to happen by 2032.

302 though has some interesting results.

If you don't care about stats you can ultimately just have the theme just show the link instead of linking to SMF to do the redirect.

badon

Recycling boards isn't quite on point, since you would also need to be moving the same specific content around too. Correct me if I'm wrong, but I think your use case would either require a 301, or it wouldn't matter whether you used 301 or 302.

badon

Quote from: Arantor on May 02, 2016, 08:12:22 AM
The original use case was people using it to prominently display a link to something like we used to do here for the bug tracker (maybe we now use it for GitHub?)

Quote from: nend on May 02, 2016, 09:27:29 AM
If you don't care about stats you can ultimately just have the theme just show the link instead of linking to SMF to do the redirect.

This is how I'm using the redirect boards. It allows me to organize things in a way that makes sense for regular users, and then I can put prominent redirect links to the most important stuff at the top of everything, so it's easier for everybody to find it. Redirect boards are one of my favorite features...but now that I'm thinking about it, it isn't redirection per se that everyone needs. It just simply prominent links! I think nend has the right idea. Maybe the way to "fix" this bug is to perhaps add a feature that allows creation of ordinary links that do nothing other than link to something.

However, in my use case, I thought I didn't care about the click count statistics, but it has turned out to be very handy in figuring out what kind of "shortcut links" are the most useful. Of course, if we added a new feature that did not involve redirects, it could still count clicks easily enough with just ordinary URL parameters.

Good thinking, nend. Sometimes the obvious solution is the hardest one to see :)

Advertisement: