标题重定向错误 [英] Header Redirect Bug

查看:75
本文介绍了标题重定向错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行永久重定向时遇到问题。它只有在我直接发送新的位置标题(下面的示例中的第三行)时才有效,但

永远不会与发送301永久移动相关联。第一个

(下面第二行)。不幸的是我的服务器屏蔽了错误

来自我的消息(我无法访问PHP.INI)。


----- - 样品-------

< ;?

标题(HTTP / 1.1 301永久移动);

标题(位置:http://www.example.com");

?>

------------- ---------


(注意:在发送

标题之前,任何地方或其他地方都没有空间。另外:我不能永远发送永久移动。

它总是打破我的剧本,但我不知道为什么。)


什么可以我做?如果我重定向没有301我恐怕谷歌不会改变

它是我的页面索引。


任何帮助非常感谢!

I have a problem doing a permanent redirect. It works only if I
directly send the new location header (third line in sample below) but
never in combination with sending a "301 Moved permanently" first
(second line below). Unfortunately my server is shielding error
messages from me (and I don''t have access to the PHP.INI).

------- Sample -------
<?
header("HTTP/1.1 301 Moved permanently");
header("Location: http://www.example.com");
?>
----------------------

(Note: there is no space anywhere or anything else before I send the
header. Also: I cannot send the "Moved permanently" on its own either.
It always breaks my script, but I don''t know why.)

What can I do? If I redirect without 301 I''m afraid Google won''t change
it''s index of my pages.

Any help greatly appreciated!

推荐答案

>不幸的是我的服务器屏蔽了我的错误消息


在脚本的顶部添加:


<?php

error_reporting(E_ALL);

ini_set(''display_errors'',true);

?>


-

~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.quicksitedesign.com?em

Application Developer Site : www.digitallysmooth.com?em

~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Unfortunately my server is shielding error messages from me

At the top of your script add:

<?php
error_reporting(E_ALL);
ini_set(''display_errors'', true);
?>

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
Wil Moore III, MCP Site : www.quicksitedesign.com?em
Application Developer Site : www.digitallysmooth.com?em
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~


Philipp Lenssen写道:
Philipp Lenssen wrote:
-------示例-------
<?
标题(HTTP / 1.1 301永久移动);
标题("地点:http://www.example.com");
?>
----------------------

我该怎么办?如果我在没有301的情况下重定向,我恐怕Google不会改变它的页面索引。
------- Sample -------
<?
header("HTTP/1.1 301 Moved permanently");
header("Location: http://www.example.com");
?>
----------------------

What can I do? If I redirect without 301 I''m afraid Google won''t change
it''s index of my pages.




也许吧?


<?php

header(''HTTP / 1.1 301永久移动'');

header(''HTTP / 1.1 302 http://www.example.com/''); //也试试307

?>


HTTP RFC: http://www.faqs.org/rfcs/rfc2616.html

-

- =我的邮箱只接受= -

- = Content-Type:text / plain = -

- =大小低于10001字节= -



Maybe?

<?php
header(''HTTP/1.1 301 Moved permanently'');
header(''HTTP/1.1 302 http://www.example.com/''); // also try 307
?>

HTTP RFC: http://www.faqs.org/rfcs/rfc2616.html
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--


2004年1月20日20:58:58 GMT,Philipp Lenssen <在** @ outer-court.com>写道:
On 20 Jan 2004 20:58:58 GMT, "Philipp Lenssen" <in**@outer-court.com> wrote:
我在执行永久重定向时遇到问题。它只有在我直接发送新的位置标题(下面的示例中的第三行)时才有效,但
永远不会与发送301永久移动相关联。第一个
(下面的第二行)。不幸的是我的服务器屏蔽了来自我的错误消息(我无法访问PHP.INI)。

-------示例----- -
<?
标题(HTTP / 1.1 301永久移动);
标题(位置:http://www.example.com");
?>
----------------------

(注意:任何地方或其他地方都没有空间在我发送
标题之前。另外:我不能单独发送永久移动。
它总是打破我的剧本,但我不知道为什么。)

我该怎么办?如果我在没有301的情况下重定向,我担心谷歌不会改变它的页面索引。
I have a problem doing a permanent redirect. It works only if I
directly send the new location header (third line in sample below) but
never in combination with sending a "301 Moved permanently" first
(second line below). Unfortunately my server is shielding error
messages from me (and I don''t have access to the PHP.INI).

------- Sample -------
<?
header("HTTP/1.1 301 Moved permanently");
header("Location: http://www.example.com");
?>
----------------------

(Note: there is no space anywhere or anything else before I send the
header. Also: I cannot send the "Moved permanently" on its own either.
It always breaks my script, but I don''t know why.)

What can I do? If I redirect without 301 I''m afraid Google won''t change
it''s index of my pages.




你还没有说你实际上遇到了什么问题,除了它'打破了'/ b $ b你的剧本'。

http://uk.php.net/header


你在做什么看似正确从手册。还有

的替代方案:


header(" Location:http://www.example.com" ;, false,301) ;


-

Andy Hassall< an ** @ andyh.co.uk> / Space:磁盘使用情况分析工具

< http://www.andyh.co.uk> /< http://www.andyhsoftware.co.uk/space>



You haven''t said what problem you''re actually having, other than it ''breaks
your script''.

http://uk.php.net/header

What you''re doing appears correct from the manual. There''s also the
alternative of:

header("Location: http://www.example.com", false, 301);

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>


这篇关于标题重定向错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆