Tld to www redirect

how do i make my tld website redirect to www version using .htaccess?

Try to use this .htaccess code:

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

where yourdomain.com can be replaced with your domain, and if you need https://www. redirect overwrite http with https too.

3 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.