Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Which order for 301 & 302 redirections

         

bbenjo

12:29 pm on Jul 15, 2014 (gmt 0)

10+ Year Member



Hello,

I need to apply a 301 and a 302 redirection on a page and I want to know in which order it's better to do it (301 before 302 or 302 before 301).

My use case is about an URL :
- with encoding glitches (for example, use of %20 instead of +) for which I want to redirect permanently (301) to the correctly encoded URL
- for which no content exists currently (but could in the next few months) and I want to redirect temporarily (302) to another webpage

Thank you

goodroi

1:47 pm on Jul 15, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Mixing 301 & 302 is a little like mixing vinegar and baking soda - the order is not as important as the end result. If at all possible try to avoid this. Get creative. Worst case you can do it, I have seen Google follow it both ways but it is rarely if ever the best way to handle the situation.

Planet13

2:35 pm on Jul 15, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



"- for which no content exists currently (but could in the next few months) and I want to redirect temporarily (302) to another webpage"

Your users would probably appreciate a helpful 404 page instead.

not2easy

4:40 pm on Jul 15, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The URL with the "%20 instead of +" currently exists - yes or no? If yes: correct the URL and send requests for the badly encoded URL to the correctly encoded URL via 301. If no, return a 404.

lucy24

7:09 pm on Jul 15, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



for example, use of %20 instead of +

Actually %20 is a space, but never mind that. I hope you're talking about material in query strings; if your paths contain spaces of any kind, change them.

In English:

example.com/blahblah?here%20and%20there
>>
301 "you really meant 'example.com/blahblah?here and there'"
>>
302 "but right now that page doesn't exist either, so for the time being try 'example.com/blahblah?otherpage'"

Is that right?

"could in the next few months" seems awfully vague. If the page doesn't exist yet, why are there links to it? Has it existed in the past? If this an e-commerce type of thing, it may be more appropriate to return a numerical 404 or 410 response-- so the page doesn't get indexed-- accompanied by a physical "out of stock" page. The physical page, to be seen by humans, can include as much information as you like.

Redirecting to a 404/410 isn't ideal either, but sometimes doing it in a single step is more trouble than it's worth.

bbenjo

7:48 am on Jul 16, 2014 (gmt 0)

10+ Year Member



Thank you for all your answsers. I'm going to give more precisions on my use case :
- The encoding issue in URLs comes from old links that were generated in a wrong way. Unfortunately, these links are already indexed and could generate duplicate content issue (as /my%20page and /my+page serve the same content)
- The site is kind of a bilingual dictionary search service, so when a user searches for a word in Spanish-English and is not found, it makes sense to revert the search to English-Spanish direction. But as more content will be added to Spanish-English, the previous search could then return results.

not2easy

2:38 pm on Jul 16, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I assist at a site that is set up to search through products and it was set to return people to the main search page when the exact search term was not found. Google called it a soft 404, which is dumb but it needed to be dealt with. I put the same search they would see on the default page in a noindexed custom 404 page and Google is happy. Technically it is a 404 but they see the same page with additional options that they would see if we didn't need to deal with soft 404s. Instead of a no-results page it serves a 404 header and delivers the custom page. It is getting Google smiles today.