Change 302 redirect to 301 redirect

911 - March 30, 2009 - 11:33
Project:User Referral
Version:6.x-1.x-dev
Component:Code: referral
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I checkt the header status of the redirect with the following tool
http://www.seoconsultants.com/tools/headers.asp
and noticed it response a 302 redirect.

Using a 302 redirect for this is not the good choice. It should be a 301 move permanantly.
See
http://www.bigoakinc.com/blog/when-to-use-a-301-vs-302-redirect/
http://www.mattcutts.com/blog/seo-advice-discussing-302-redirects/

How to change the 302 to a 301?

#1

GregCTU - June 8, 2009 - 16:33

I'm confused, why did they choose to use 302 as opposed to 301s for the url alias module?

#2

jackinloadup - June 30, 2009 - 19:09
Status:active» needs review

I agree the links should have 301 redirects.

After a little digging it looks like User Referral used drupal_goto to redirect the user to the correct page. According to the API docs (http://api.drupal.org/api/function/drupal_goto) we can make these redirects a 301 redirect pretty easily.

I have included a patch that makes the necessary changes.

I think this is the proper way to do the redirect. Please review and comment!

Also my referral path is set to a url that is controlled by securepages (http://drupal.org/project/securepages) This module also does a 302 redirect. I filed an issue and patch to change their redirect to a 301. http://drupal.org/node/506522

On a related note, maybe the User Referral admin page should contain a setting to set if the referral path is https or not. This would only be to help avoid 2 redirects when in use with a solution like securepages.
As is stands now the process is like so:
referral redirect -> securepages redirect ->destination

this would allow a shorter (faster?) path to the end.
referral redirect -> destination
I dont know how this affects SEO or speed but it seems cleaner.

So not a huge deal.. just a thought.

AttachmentSize
referral_301_redirect.patch 744 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.