View Full Version : Redirect?
ergobob
06-22-2007, 11:11 AM
Hello,
Can someone remind me how you make "mysite.com", "www.mysite.com, and
http://mysite.com all point to "http://www.mysite.com"?
I just want to make all forms of the URL point to the one main URL but
can't recall where to do it or how to do it.
I do have this in the .htaccess file but I am not sure if it is it
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.usernomics\.com$
RewriteRule (.*) http://www.usernomics.com/$1 [R=301,L]
Thanks,
Bob
bobettekyle
06-22-2007, 04:47 PM
Mine's a little different. I'm certainly no coding expert, but it works:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.domainname\.com
RewriteRule ^(.*) http://www.domainname.com/$1 [L,R=301]
ergobob
06-22-2007, 05:27 PM
Thanks Bob,
I think the one I have is doing the job pretty well.
However, I now have added a sub domain of "jobs.usernomics.com" that
also works with Usability & User Interface Design - Job Listings (http://jobs.usernomics.com) but it does not work with
http://www.jobs.usernomics.com or with www.jobs.usernomics.com.
So I would like to point the latter two to one that works such as
"jobs.usernomics.com". Would another script in my htaccess file do
that? If so, do you know what the script would look like?
Thanks Again,
Bob
Christiaan
06-22-2007, 06:23 PM
The following seems to work OK:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
I think I am not wrong when I say that
http://www.jobs.usernomics.com
is not a valid URL
You can't use the www when there is a subdomain name like jobs in front of your domain name.
ergobob
06-22-2007, 07:38 PM
Oh my. I missed the whole point. That's why http:/www and www. do not work.
Thanks for pointing that out. Much appreciated.
Bob
Keimos
06-22-2007, 07:59 PM
Hi ergobob,
This might seem to easy but ask your ISP to give you the option to have www or , mysite.
This is a hosting issue as www.mysite.com is the same as mysite.com if allowed by your host
Regards
Keimos
Tiggerito
06-25-2007, 12:05 AM
On a related note, you can use Googles WebMaster Tools to specify if they will include the 'www.' on links to your website.
Yes in Google webmaster tool you need to register your site in that you have the option to select Preferred Domain which will do it all for you, save your time :-D.
SemAdvance
06-25-2007, 09:22 AM
On a related note, you can use Googles WebMaster Tools to specify if they will include the 'www.' on links to your website.
Yes in Google webmaster tool you need to register your site in that you have the option to select Preferred Domain which will do it all for you, save your time :-D.
This only fixes things with Google. The htaccess file approach above fixes all canonical issues with all search engines.
Peace