javascript - redirected page overrides real page in google search -


i have 2 sites... good-one , bad-one. wrote program , stuck on site.

then put (just javacript test) window.location="good-one" on bad-one.

i found out needed know , didn't bother removing redirect (who cares?).

but in google searches instead of site coming up... bad 1 shows in searches , if click of course redirected one.

so put whole url of site google search (just see happen) , number on spot bad one. site not in google index anymore. bad 1 took over.

does redirection page have priority on actual page?

is supposed happen?

using window.location isn't way change results in google. have use http headers instead. set 301 http header on server side.

http://en.wikipedia.org/wiki/http_301

example in php

header ('http/1.1 301 moved permanently'); header ('location: good-one'); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -