Url in htaccess [duplicate]

0

Is it possible to control the url in htaccess? For example, if you type site.com.br, it corrects and places www.site.com.br.

I have a case that some pages go with site.com.br/blog. Others with site.com.br/we have an error, because it sends to link .

The htaccess I'm using is this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

## EXPIRES CACHING ##
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

(Sorry, but I did not find another way to put it here).

    
asked by anonymous 07.05.2018 / 21:28

1 answer

0

You are redirecting link to the link correctly. You now need to redirect to the correct domain:

# Redirecionando do domínio errado (sem www) para o correto (com www)
RewriteCond %{HTTP_HOST} !^www\. # Verifica se tem o www
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Put this after your last rule, ie after RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} .

    
08.05.2018 / 00:53