Problem . htaccess for www-free addressing

Asked

Viewed 56 times

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 setting 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] 

2 answers

1


Flag missing L in the first Rule, thus:

# ======== 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 don’t need two RewriteEngine On

  • straight, worked and solved my problem. Thank you!

0

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

The command corresponds 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]

Browser other questions tagged

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