Home » SEO » How to remove www from domain link or URL

How to remove www from domain link or URL

Most website hosts allow your website load for URLs with www or without www. But many webmasters and bloggers prefer their domain links or URLs as http://domainnamelink.com instead of http://www.domainnamelink.com. Out of ignorance, some webmasters allow both sort of URLs to work but the search engines see it as duplication. So you should either opt for with-www or without-www.

If you want to remove www from your URL you can make some adjustments in the .htaccess file. This file normally exists in your root folder on your server and takes care of your 404 error pages and permanent redirections [read how to create effective 404 error pages using .htaccess and how to redirect old website domain to new domain using .htaccess file]. If this file exists in your root folder download it and take backup. If it doesn’t exist you can create it using any standard text editor.

Without deleting existing content, you can add the following lines to your .htaccess file:

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

This uses the permanent link redirection error number to redirect all URL requests to the non-www version.