开发者

HTML: should I add meta information to the forwarding php page?

开发者 https://www.devze.com 2022-12-29 20:33 出处:网络
I\'ve to correct the google search title and summary for a website having the following code as home page:

I've to correct the google search title and summary for a website having the following code as home page:

<?php
   header("Location:/mil/index.php");
?>

It forwards the user to another page. I know this is not good, but I was wondering how to quickly fix it.

If I ad开发者_如何学Cd etc... to this page, is enough ? Is google grabbing the information from this page ?

Or is it grabbing from the website pages and bypassing this page ?

thanks


At the moment you are performing a 302 redirect, which tells Google that content found at the first page has temporarily moved to the second. Because of this, Google will not update it's index, and will continue to treat the first page as the important one. If it's empty, then that is no good for your search rankings. Do this instead:

header ('HTTP/1.1 301 Moved Permanently');
header ("Location:/mil/index.php");

A 301 redirect tells Google that the content has permanently moved to the new location, and they will update their index appropriately.

If this is a permanant redirect, and you have access to the .htaccess file, then a faster, cleaner way of doing this would be to let Apache handle it. If your first script contains nothing but that redirect, then delete it completely and add this line to your .htaccess file:

Redirect 301 /the-first-script.php /mil/index.php
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号