Deprecated: Assigning the return value of new by reference is deprecated in /home/xtremebl/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/xtremebl/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/xtremebl/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/xtremebl/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/xtremebl/public_html/wp-settings.php on line 18
Redirecting Domain.com to www.Domain.com « XTREME Blog Network

Redirecting Domain.com to www.Domain.com

March 8th, 2009

One way to optimize your website for search engines is to have everything on one domain. Search engines (as do some user) consider www.domain.com and domain.com to be two separate locations. Sometimes, you can find different content at these locations. To prevent a search engine getting confused and to also increase your pagerank, both of these domain should point to the same location.

You can do this using Mod Rewrite, an extension for Apache. Simply put the following code into you ‘.htaccess’ file on the root of your website to redirect all traffic from domain.com to www.domain.com:

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

The above rewrite code also works for subdomains.

Tags: ,

Leave a Reply