Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda