1

While working on the SEO of a site, we noticed that, just for the homepage we have 5 redirects (301 and 302).

http://mydomain.be = 301 => https://mydomain.be (well, that one, OK)

https://mydomain.be = 301 => https://mydomain.be/en (EN is the default language)

https://mydomain.be/en = 302 => https://mydomain.be/en/node/42

https://mydomain.be/en/node/42 = 301 => https://mydomain.be/fr/the-clean-url (why does the language detection only appears here? )

https://mydomain.be/fr/the-clean-url = 301 => https://mydomain.be/fr (because this is the homepage)

That's quite a lot of redirect jus for one page... Is there any way to reduce that?

Like don't go to the default language and directly go to the good language? Or don't redirect to the clean URL if this is juste the homepage?

  • so the homepage has no default language (EN) translation ?? – rémy Jul 8 '16 at 11:43
1

.htaccess file using redirect.

IfModule mod_rewrite.c

Redirect 301 /fromurl /tourl

Example:

Redirect 301 /http://www.example.com /https://www.example.com

Try it.

0

For the very first redirect, from http to https, one mitigation is to use the HTTP Strict Transport Security (HSTS) response header. A way to do that in Drupal is the Seckit module. This header will help browsers to know that when they visit your site they should always use https. It would also be good to use https in links to your site wherever possible.

The rest of the redirects will probably need to be resolved with individual module/core issue queues. My guess is that the Redirect module is involved. I suggest using the Devel module's "show redirect page" feature and looking for calls to drupal_goto so you can understand why/where the redirects are happening and then investigate how to optimize them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.