How to correct this? 301 redirect

did this website grader and it has this note:

Permanent Redirect Not Found Search engines may think www.url.com and url.com are two different sites.You should set up a permanent redirect (technically called a “301 redirect”) between these sites. Once you do that, you will get full search engine credit for your work on these sites.

I know 301 redirect, when it comes to pages, but don’t really know how to go about this.
where do i place the redirect lines and how do I query if they entered www.url.com or url.com?

thanks

Create an .htaccess file and put this in it. Obviously change url.com to your domain:


Options +FollowSymLinks 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^url.com [NC] 
RewriteRule ^(.*)$ http://www.url.com/$1 [L,R=301]

search .htaccess 301 redirect in google

//edit, or do what it says above…

server is IIS (ASP) and when I was looking for info, correct me if I am wrong, that it cannot run .htaccess file

You are correct, stupid IIS. Anyway, this link, though very old might help you: http://www.xoc.net/works/tips/domain.asp

If you are on shared hosting, you may need to contact your hosting provider to have this done.

would you suggest something like this? though I would have to put in every page, but is it an option?

<%@ Language=VBScript %>
<%
If InStr(Request.ServerVariables(“SERVER_NAME”),“www”) = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader “Location”,"http://www.sitename.com"
Request.ServerVariables(“HTTP_HOST”)
Request.ServerVariables(“SCRIPT_NAME”)
End if
%>

If you had set your DNS records up properly this wouldn’t be a problem.

actually, I didn’t set it up and I don’t have access to the settings, it’s a company site. I would have to tell admin to do it.

If they’re employing someone to handle it, tell him to do his ■■■■ job.