The WWW (World Wide Web) prefix, or subdomain, has been around since the early days of the internet and its inclusion in domain names was, in the past, considered standard practice.
In modern times, it is largely seen as having no functional benefit, though there is some debate regarding its impact on Search Engine Optimization (SEO). Generally speaking, the inclusion or exclusion of WWW is largely a matter of aesthetic preference.
Here we cover the steps to redirect visitors to the www or non-www version of your domain by adding a redirect to your website's .htaccess file.
Related Articles
Getting Started with cPanel
Edit File with File Manager
Find the Document Root of a Domain
Show Hidden Files in File Manager
Edit .htaccess
- Log into cPanel
- Navigate to File Manager, located under the Files section
- Navigate to the domain's document root
- Locate the .htaccess file, right-click on it and click Edit
NOTE: As .htaccess starts with a "." it is a hidden file, so you will need to ensure hidden files are shown. See the guide on showing hidden files for instructions. - Copy and paste one of the following to the top of the file
- Force www:
#Force WWW:
REPLACE: both instances of domain.com with your actual domain.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301,NC] - Force non-www:
#Force non-www:
REPLACE: both instances of domain.com with your actual domain.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
- Force www:
- Click the Save Changes button
Comments
0 comments
Article is closed for comments.