How to redirect non-www URLs to www?

Website Templates and Extensions Forums General Questions How to redirect non-www URLs to www?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #26932072
    WPAha
    Keymaster

    You can redirect all of the requests for yourdomain.com domain to http://www.yourdomain.com by modifying your website’s .htaccess file. You need to add the following lines at the beginning of the file in order to setup that redirection:

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

    Where yourdomain.com is your actual domain name.

    You can edit the .htaccess file using the File Manager in cPanel or via FTP.

    From now on, when someone access http://yourdomain.com the visitor will be redirected to http://www.yourdomain.com.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.