How to remove world wide web – WWW

Version: 13.1
Revision: 22 Build 12c

How to remove world wide web – WWW

Introduction:
everyday in my life, there are hundreds of users, who would like to get rid of this annoying “world wide web”, which is located on their hosting services and the address bar. These strings can be remove by using “htaccess” commands, to redirect a web-link into an url without “www”.

Example: all urls will be redirect by the ‘htaccess’ files, from “www.example.com” to “example.com”, even if the “www” is typed into the address box.

1.] Create a single “.htaccess” file or add this code into the top of your “.htaccess” file.
But, you must delete your old “htaccess” files (server files) before you transfer it into your hosting server. If you overwrite it, the codes will not work…

—Copy Source Code—

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

—End Source Code—

Notes: replace “example” with your own domain names (before you import). After that, just clear your internet browsers’ temporary files and caches.

2.] Check your website by typing the urls with “www” and see it for yourself.

3.] Finish!

Tips: if you want to be smart and keep your page rank from being slaughter, you can use this htaccess methods to hide this problem.

—Copy Source Code—

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

—End Source Code—

Notes: just remove the “#” symbol, if you want to activate “FollowSymLinks”.

Comments are closed.