For Search Engine Optimization (SEO) purposes, it is desirable to have your website answer only to http://www.example.com or http://example.com. Otherwise, the search engines see "duplicate content" on each, and downgraded your site in the results ranking accordingly.
A fix is simple, however, using mod_rewrite for Apache. In your ~/public_html directory, create a file named ".htaccess" (or modify an existing one).
If you do want the www, the entry should look like:
RewriteEngine on
Rewritecond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
The rule above will force www to be added to the URL if the user does not put it in there to begin with, meaning all your content will be seen at http://www.example.com. The "R=301" tells anyone requesting the "bad" URL that it has been permanently moved to the "good" version. And the "L" means this is the last step in the rule.
If you do not want the www, the entry should look like:
RewriteEngine on
Rewritecond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Please note that if you already have a ".htaccess" in place make sure to add/edit the file not over write it.
Rating:
9.1/10
Powered by WHMCompleteSolution
Print this Article
Home
Submit Ticket
Knowledgebase
Domain Checker
View Cart
Register
Hosting Login