Should I Use WWW in my site name?
Some users type “www.topbits.com” into their web browsers when they want to reach this web page. Other users type in only “topbits.com”, leaving off the “www” portion.
On a technical level, the two names do not refer to the same domain object.
Google, and other search engines, often see these two objects as seperate web servers.
Check the PageRank for several domains to see the results of this. For some domains, the PageRank will be the same for both the www and non-www domains. For other domains, the PageRank will differ for each domain.
If your web server does not answer on both names, users may become confused and not be able to get to your site.
On the other hand, if your web server does answer on both domains, other webmasters may link to either name for your site. The trouble this causes is that your links are now split between two domains, weakening their effectiveness.
Most webmasters choose to redirect all user requests to the www version of their domain name. Try typing “topbits.com” into your web browser. You will automatically be redirected to “www.topbits.com”.
The best way to implement this on your web server is to use Apache’s mod_rewrite functionality to redirect all user requests to the domain name of your choice.
Loading mod_rewrite into Apache
The first step is to edit your httpd.conf file to load the mod_rewrite module.
This has most likely already been done. If not, however, it is very simple to add.
1. Find the section in your httpd.conf file which contains the LoadModule commands.
2. Add this LoadModule command if it does not already exist:
LoadModule rewrite_module /usr/local/libexec/apache/mod_rewrite.so
Be sure to use the correct location of the mod_rewrite.so file on your system.
Option: httpd.conf or .htaccess
The next step is to configure the rewriting rules. This may be done either in your httpd.conf file or in individual .htaccess files.
If you have access to httpd.conf, it is probably easiest to make the modification there. If you are on a shared server and do not have access to edit the httpd.conf, it is no more difficult to make the modifications to your .htaccess file.
The choice of locations is often a matter of personal taste.
Rewriting to WWW in httpd.conf
To configure the rewrite rule in httpd.conf, edit the appropriate VirtualHost container.
Add the lines below to the VirtualHost container for your web site.
Be sure to edit the hostname to match the settings on your server.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.example.com(:80)?$
RewriteRule ^/(.*) http://www.example.com/$1 [L,R=301]
Rewriting to WWW in .htaccess
The syntax for .htacess is very similar
Be sure to edit the hostname to match the settings on your server.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
</IfModule>
For more detailed instructions on implementing a redirect to WWW into .htaccess, read That Pesky www.
Comments - No Responses to “Should I Use WWW in my site name?”
Sorry but comments are closed at this time.