Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

96
Visualizações
website redirections different from .htaccess configuration

I have web page created in Wordpress v5.4, Theme Twenty Twelve and just installed SSL certificate.

I want to have such redirection structure (redirection codes in rectangles), to optimize for SEO:

enter image description here

but according to Google Chrome Site Inspector I have the follwing one:

enter image description here

So the schema is not fully optimized as for two cases there are dwo cascade redirections whereas should be one.

What is weird, current schema doesn't reflect .htaccess file. My .htaccess file looks as follows:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

So, my understanding of the code is that if url is typed in without https://, script rewrites it into version with https:// an nothing else, so there must be another place where other redirections (e.g. with www -> without www) are being made.

I have checked index.php - no redirections.

I also checked additional lines in .htaccess file don't overwrite those "hidden" ones, so if I simply add them I got multiple redirections error in web browser.

Could you please advise me what else should I do to get desired structure of redirections?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

First rule redirect all www to https://domainname.com/, second all http to https://domainname.com/, one hop

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule (.*) https://domainname.com/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://domainname.com/$1 [R=301,L]

</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
over 4 years ago · Santiago Trujillo Relatório

0

I’m guessing the redirect from www to non-www is due to the address you’ve set in your settings (WordPress dashboard → Settings → General).

For the redirect you want to achieve, you have to add rewrite conditions for the www. in your .htaccess

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda