Redirecting Webpage To WWW Prefix

Published May 24th 2009
Filed under HTML

When a domain is entered in a browser, it can be entered with or without the www prefix. For example, Let-Go.net can be reached from either let-go.net or www.let-go.net. Search engines will pick this up as 2 different webpages which will half your ranking on the search engines search results. There is a way to make make it a single webpage using a redirection. You must choose to either use the www prefix or not. To do this, make a new .htaccess file or edit an existing one in the root of where your site is hosted. In the .htaccess file, enter the following replacing the Let-Go.net url with your own:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.let-go\.net [NC]
RewriteRule ^(.*)$ http://www.let-go.net/$1 [L,R=301]
</IfModule>

Save the file and upload it. This will redirect your site to the www prefix when the prefix is not entered making it one webpage on search engines. To redirect it to exclude the www prefix, take out “www\.” and the “www.” in the code above.

How To Center A DIV Element

Published May 16th 2009
Filed under CSS

Centering a DIV Element doesn’t work the same as centering everything else. Using style="text-align:center" doesn’t work. There is still a way of centering it. You have to use the following css code:

style="width: 600px; margin-left: auto; margin-right: auto;"

Set the width to whatever you want it to be and it centers the DIV Element as you want it to.