最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Javascript redirect vs PHP redirect, which would search engines see as regular content - Stack Overflow

programmeradmin2浏览0评论

I'm guessing that using PHP's header("location: here.html") would be much better javascript's window.location("here.html") as far as search engine visibility goes. I would assume that the server redirect would show google the correct content and the javascript redirect would be read as a page with the javascript redirect code in it.

Reason being is I have a client that wants me to take their current website and import it into a CMS system (I'm using e107) and I don't want their old pages to lose their current page rank. I was thinking of putting redirects on the old pages to the new pages in the CMS system.

I'm guessing that using PHP's header("location: here.html") would be much better javascript's window.location("here.html") as far as search engine visibility goes. I would assume that the server redirect would show google the correct content and the javascript redirect would be read as a page with the javascript redirect code in it.

Reason being is I have a client that wants me to take their current website and import it into a CMS system (I'm using e107) and I don't want their old pages to lose their current page rank. I was thinking of putting redirects on the old pages to the new pages in the CMS system.

Share Improve this question asked Aug 19, 2009 at 15:13 slimslim 2,5831 gold badge24 silver badges39 bronze badges 1
  • 1 header("location: here.html") is not technically valid and I know that Google plains when it appears in sitemaps. You should use a full, not a relative, URL. – TRiG Commented Sep 16, 2010 at 14:39
Add a ment  | 

2 Answers 2

Reset to default 8

The only way to forward on search engine rank is with an HTTP 301 (permanent) redirect.

Using PHP's header('Location') will give a 302 unless you specify the code like this:

header('Location: http://....', true, 301);

It might be easier to use .htaccess, like this:

RewriteRule ^old.php /new.php [R=301]

Yes, you want to do server side redirection (PHP) if you can.

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url." );
?> 

via

You can also do this using

header("location: http://www.new-url.")

but it won't be as good SEO wise

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论