Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we do 302 redirect with javascript?

Or does it have to be server side?

Currently google requires all sites to 302 to a page rather than the usual pages.

How do I do so with javascript? Can I just print a 302 code in meta or something?

Note: sorry. This is not google for search engine. This is google the feed provider for bodis.com above.com namedrive.com and a bunch of other guy.

I am a domain parker. I get domains ranked at search engine and move traffic somewhere else. The problem is google now prohibit URL forwarding. I am just thinking how do I maintain my ranking with more transparent forwarding such as 302. The destination URL is pretty, I would say blank.

like image 663
user4951 Avatar asked Oct 05 '11 07:10

user4951


1 Answers

This is how a 302 redirect works:

HTTP 302 means found. In a way, the server tells the client where to retrieve the page it requested.

Example:

The client sends:

GET /index.html HTTP/1.1
Host: www.yourdomain.com

The server responds:

HTTP/1.1 302 Found
Location: http:/yoursubdomain.someotherdomain.com/somefolder

This is why you couldn't achieve a 302 redirect using javascript. It's part of the HTTP protocol. No page gets loaded by the client's browser before the redirect is performed.

like image 177
Dennis Avatar answered Oct 02 '22 15:10

Dennis