.htcaccess 301 redirect does not work

Asked

Viewed 54 times

-1

The redirection of https://www.meusite.com for https://meusite.com doesn’t work. And as a result I get the site in duplicate, one page I’m logged in and the other not.

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

1 answer

1


It is not working because you are commenting on the lines that "do the job" (lines 3 to 5). Then try to remove the symbols # from the beginning of these lines:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.