.htaccess problem for addressing without www

0

When I type in the browser

  

phimodasecia.com.br

My site / store enters (is redirected) with error as below:

  

https://www.phimodasecia.com.br/https://phimodasecia.com.br/

My configuration for .htaccess is

# ======== COMEÇA AQUI ========
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# ======== TERMINA AQUI ========

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^phimodasecia.com.br [NC]
RewriteRule ^(.*)$  https://www.phimodasecia.com.br/$1 [r=301,NC] 
    
asked by anonymous 01.02.2017 / 01:32

2 answers

1

The L flag is missing on the first Rule , like this:

# ======== COMEÇA AQUI ========
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
# ======== TERMINA AQUI ========

Options +FollowSymlinks
RewriteCond %{http_host} ^phimodasecia.com.br [NC]
RewriteRule ^(.*)$  https://www.phimodasecia.com.br/$1 [R=301,NC]

You do not need two RewriteEngine On

    
01.02.2017 / 02:49
0

Try to add the L flag to stop processing the other rules. This means that if the rule matches, no other rules will be processed.

The command is corresponding to last in Perl or break in C.

Use this flag to indicate that the current rule should be applied immediately without considering additional rules.

Example:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^phimodasecia.com.br [NC]
RewriteRule ^(.*)$ https://www.phimodasecia.com.br/$1 [L,R=301]
    
01.02.2017 / 01:48