homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Google / Google News Archive
Forum Library, Charter, Moderator: open

Google News Archive Forum

    
Should I use a 301 redirect?
hdpt00




msg:159651
 8:35 am on May 11, 2004 (gmt 0)

If someone types my site in as domain.com or www.domain.com should I 301 redirect them to www.domain.com/?

Thanks,
Brandon

 

mcavic




msg:159652
 3:50 pm on May 11, 2004 (gmt 0)

Yes, you should. That will eliminate duplicate sites in the SE's.

bhartzer




msg:159653
 4:50 pm on May 11, 2004 (gmt 0)

mcavic is right, you should definitely use a 301.

hdpt00




msg:159654
 7:22 pm on May 11, 2004 (gmt 0)

Now how exactly do I do this redirect in .htaccess so if they come to domain.com or domain.com/ or www.domain.com I send them to www.domain.com/?

Thanks,
Brandon

toolkit




msg:159655
 7:39 pm on May 11, 2004 (gmt 0)

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# rewrite to include www.
RewriteCond %{HTTP_HOST}!^www\.yourdomain\.com$
RewriteRule ^(.*)$ [yourdomain.com...] [R=301,L]

jdMorgan




msg:159656
 7:53 pm on May 11, 2004 (gmt 0)

The code above will not work if a visitor or a network cache appends a port number. Do not end-anchor the hostname.

Jim

hdpt00




msg:159657
 10:14 pm on May 11, 2004 (gmt 0)

So then, what is the difinitve way to make sure it always goes to www.domain.com/? I'm not very good with this Apache stuff.

Thanks,
Brandon

mcavic




msg:159658
 2:35 am on May 12, 2004 (gmt 0)

This is what I use:

RewriteEngine on
RewriteCond %{HTTP_HOST}!www\.domain\.com
RewriteRule ^/(.*) [domain.com...] [R=permanent]

Apache will handle adding the final / so you don't have to. It's true that it won't redirect someone who uses a port number on the end. But in general, nobody should be doing that.

jdMorgan




msg:159659
 2:59 am on May 12, 2004 (gmt 0)

For use in .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

The leading slash on the RewriteRule pattern (as shown in the previous post) should be used only if your code is placed in httpd.conf; For use in .htaccess, leave it out.

You may or may not need the Options +FollowSymLinks directive. If this option is already configured, you won't need it. Otherwise, mod_rewrite won't work, and you should get an entry in your error logs complaining that FollowSymlinks or SymLinksIfOwnerMatch are not enabled. On some servers, users are not allowed to modify Options, so you may also get an error if you try to enable that Option. The only safe, reliable way to determine this on a live, busy server is to try it in an .htaccess file in a test subdirectory.

Jim

The_Hitcher




msg:159660
 6:52 am on May 12, 2004 (gmt 0)

Except that Yahoo has a prob with 301's.....

mcavic




msg:159661
 2:14 pm on May 12, 2004 (gmt 0)

Yeah, but in this case, that's their problem, and duplicate listings will only increase one's traffic.

Laur




msg:159662
 3:05 pm on May 12, 2004 (gmt 0)
What would be the behavior of Google if all my site links would be passed through PURL.ORG redirection service (HTTP 302)?

Ex. having

http://purl.org/MYNAMESPACE/* redirecting to
http://myvolatiledomainname/*

and all the links I use in the site have purl.org as base.

I would expect that the crawler would index the site (following 302) but report in results the purl.org URLs and not the temporary redirection URLs.

Is this correct?

(I hope I'm not off-topic.)

jdMorgan




msg:159663
 3:18 pm on May 12, 2004 (gmt 0)

Right now, all of your pages would end up as belonging to that domain instead of your own. If you value your domain name, do not do this. Use a 301 redirect, not a 302!

Jim

Laur




msg:159664
 6:04 am on May 13, 2004 (gmt 0)

Great :)

That is what I'm looking for, to lock a resource in purl.org domain for creating a time persistent URL for it.

When I move the resource I will just update its redirect data on PURL. So SE can refer to it using the same address even I change domains, paths, etc.

Thanks.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google News Archive
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved