0

I would like to redirect example.com to www.example.com.

I tried from .htacess with right 301 redirect code but doesn't work.

Also without www url redirect to other domain that haven't redirect from .htacess.

Dabblernl
  • 14,939
  • 16
  • 90
  • 141

1 Answers1

0

You can try this .hataccess

<IfModule mod_rewrite.c>
Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

Make sure your .htaccess only one "RewriteEngine On". So, you can put

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

To below RewriteEngine On

Sorya Kim
  • 1
  • 1