Problem/Motivation
The module always use 302 code for redirect https to http url. For different cases needed return 301 code. It's also will be better for google/bing/yandex.
Proposed resolution
Change securepages_goto() for use new variable "securepages_code" for redirect instead 302 code always. The variable can be change on module administration page.
User interface changes
Securepages administration page have new option "Redirect HTTP Code" with two values "301 Moved Permanently" and "302 Found".
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | securepages-select-http-code.patch | 2.23 KB | m@ster |
Issue fork securepages-2381857
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
spleshkaFirst of all I think this is not a bug report but a feature request - module may work without this patch correctly. Also this issue is not major, because it doesn't add something incredibly important to the module. So I have changed these fields.
Now about your patch:
1.
This doesn't match Drupal coding standards - else should be on a next line after closing bracer.
2. If you have introduced a new variable - you have to add it to the hook_uninstall() section as well.
3.
I think, better to rename it to "HTTP response status code of the URL redirect.". Otherwise this description is hard to understand.
Comment #2
m@ster commentedthank you, fixed
Comment #3
m@ster commentedComment #4
spleshkaAgain wrong coding standards :) You should have a space after "else".
Comment #5
m@ster commentedfixed
Comment #6
spleshkaThanks @Rusland, now patch looks good! I've also tested it on simplytest.me - works as expected. So now we are waiting to commit this patch.
Comment #7
loparev commented+1
@gordon, do you have plans to commit this patch?
Comment #8
peter.thorndycraft commentedJust wanted to add our experience which this patch:
We were experiencing cron and timeout issues on the site and the root problem was that 302 redirects, caused by some pages being secured, were causing cron tasks to not complete properly. Applying this patch fixed the problem.
Comment #9
modulist commentedrusl@n's patch in #5 worked beautifully for us. However, we missed the part about the affordance in the Drupal admin UI, that lets you toggle between 302 Found and 301 Moved Permanently redirect codes at /admin/config/system/securepages
If you're fairly confident in your new HTTPS setup, you will want to use the 301 Moved Permanently code. Having a 302 Found code will be detrimental to the authority of your SEO rankings as the search engines will consider your new pages temporary.
Another way to toggle the variable is through drush:
Hopefully this comment will save someone else hours of grief by making the same silly mistake we did!
Comment #10
VanD commentedI'd like to see this committed to the module as well.
Comment #11
philosurfer commentedPlease commit today! One less patch to manage please. :^D
Comment #12
rahul.nahar001 commentedIt's working fine on my site.
@gordon, do you have plans to commit this patch?
Comment #16
astonvictor commentedfinally merged a new MR.
thanks all.