Error with htaccess redirect No to WWW

0

I have the following code in my htaccess that makes the user redirection if he access the site without www, works perfectly if you enter the direct domain without www he will redirect, however from facebook he does not redirect.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{HTTP_HOST} ^bluanime.com [NC]
    RewriteRule ^(.*)$ http://www.bluanime.com/$1 [L,R=301]
</IfModule>

As you type bluanime.com in the browser address bar, it is redirected to the www.bluanime.com version, but in facebook if I put in the description only bluanime.com and the person click it it is not redirected, the What could be causing this?

This is the link that should make automatic redirection on facebook Link to the redirect , so far in the stack it is not redirected to the www version

    
asked by anonymous 10.04.2017 / 17:43

1 answer

0

It should be the cache of your browser that kept the redirection of something, I believe that or your .htaccess is not in the folder or is another failure, in case this is not necessary:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Do this:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^bluanime.com [NC]
RewriteRule ^(.*)$ http://www.bluanime.com/$1 [L,R=301]

If you fail to do so (this way I actually think it's better because it will be easier to port if the domain changes or uses multiple domains):

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
10.04.2017 / 18:56