使用404 htaccess重定向进行验证 [英] validation with 404 htaccess redirection

查看:67
本文介绍了使用404 htaccess重定向进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



各位大家好


有谁知道为什么w3c验证器无法获取使用404 htaccess的页面

重定向?我设置了两个网站,以便客户端请求不存在的
网址,但是htaccess将调用重定向到解析网址的脚本,并且

生成请求的网页。它适用于浏览器,但当我尝试
验证页面时,我收到404错误 - 这让我感到困惑,因为我认为

Apache在内部进行重定向而不发送客户端的错误消息是

。为什么会这样,有没有办法在这些页面上使用验证器

(其他通过上传文件进行验证)?


BartekGórny

-

#!/ usr / bin / env python

print''sygnatura''


Hello everybody

Does anybody know why w3c validator can not get pages that use 404 htaccess
redirection? I set up two web sites so that clients request non-existent
urls, but htaccess redirects calls to a script which parses the url and
produces requested pages. It works fine with browsers, but when I try to
validate the page I get a 404 error - which bewilders me, because I thought
Apache does the redirection internally without sending the error message to
the client. Why is that, and is there a way to use validator for such pages
(other then validating by uploading file)?

Bartek Górny
--
#!/usr/bin/env python
print ''sygnatura''

推荐答案

Taki Jeden< ba ********* @ interia.pl>写道:
Taki Jeden <ba*********@interia.pl> wrote:
有谁知道为什么w3c验证器无法获取使用404
htaccess重定向的页面?


没有404重定向这样的东西。 HTTP代码404表示

请求的资源不可用。对于客户来说这是不正确的。

另外对待它。

我设置了两个网站,以便客户请求不存在的网址,但是htaccess重定向调用一个脚本来解析url并生成请求的页面。


然后不要这样做。 (我们真的不知道你在做什么细节,但是很明显这是错误的。)

它适用于浏览器,


知道浏览器有bug。

但是当我尝试验证页面时,我收到404错误 - 这让我感到困惑,因为我认为Apache在内部进行重定向
而不向客户端发送错误消息。
Does anybody know why w3c validator can not get pages that use 404
htaccess redirection?
There is no such thing as 404 redirection. HTTP code 404 means that the
requested resource is not available. It would be incorrect for a client to
treat it otherwise.
I set up two web sites so that clients request
non-existent urls, but htaccess redirects calls to a script which
parses the url and produces requested pages.
Then don''t do that. (We don''t really know what you do in detail, but it is
pretty clear that it''s wrong.)
It works fine with browsers,
Browsers are known to have bugs.
but when I try to validate the page I get a 404 error - which
bewilders me, because I thought Apache does the redirection internally
without sending the error message to the client.




你做了什么?好吧,我们知道发生了什么事的可能性更小,因为你没有透露URL,更不用说明你在.htaccess文件中显示的内容了。


您是否意识到搜索引擎可能表现正常,即

如果获得404响应,则从索引中删除页面?


-

Yucca, http:// www.cs.tut.fi/~jkorpela/

关于网页制作的网页: http://www.cs.tut.fi/~jkorpela/www.html



You did? Well, we have even less odds of knowing what''s going on, since you
don''t reveal the URL, still less show what you have in the .htaccess file.

Have you realized that search engines probably behave correctly, i.e.
remove a page from their indexes if they get a 404 response?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jukka K. Korpela写道:
Jukka K. Korpela wrote:
Taki Jeden< ba ********* @ interia.pl>写道:
Taki Jeden <ba*********@interia.pl> wrote:
有谁知道为什么w3c验证器无法获取使用404
htaccess重定向的页面?
没有404重定向这样的东西。 HTTP代码404表示请求的资源不可用。对于客户来说,处理它是不正确的。
Does anybody know why w3c validator can not get pages that use 404
htaccess redirection?
There is no such thing as 404 redirection. HTTP code 404 means that the
requested resource is not available. It would be incorrect for a client to
treat it otherwise.
我设置了两个网站,以便客户请求不存在的网址,但是htaccess重定向调用一个脚本来解析网址并生成请求的页面。
I set up two web sites so that clients request
non-existent urls, but htaccess redirects calls to a script which
parses the url and produces requested pages.



然后不要这样做。 (我们真的不知道你在做什么细节,但很明显它是错的。)



Then don''t do that. (We don''t really know what you do in detail, but it is
pretty clear that it''s wrong.)




你不喜欢我不知道我在做什么,但你知道这是错的吗?很酷。


我的.htaccess文件是这样的:


ErrorDocument 404 /script.php


每当您请求不在的页面时,您的请求由''script.php''处理。

。它的工作原理 - 例如,查看 www.safetycam.pl

它适用于浏览器,



知道浏览器有bug。



Browsers are known to have bugs.




对 - 所以请打电话给Mozilla和Firefox的人,告诉他们他们的浏览器有一个严重的错误:)(当然还有微软)



Right - so please call the Mozilla and Firefox guys, tell them their
browsers have a serious bug :) (and Microsoft, of course)

但是当我尝试验证页面时,我收到404错误 - 这让我感到困惑,因为我认为Apache在内部进行重定向而不向客户端发送错误消息。
but when I try to validate the page I get a 404 error - which
bewilders me, because I thought Apache does the redirection internally
without sending the error message to the client.



你呢?好吧,我们知道发生了什么事的可能性更小,因为你没有透露URL,更不用说明你在.htaccess
文件中显示的内容了。



You did? Well, we have even less odds of knowing what''s going on, since
you don''t reveal the URL, still less show what you have in the .htaccess
file.




是的我做了,但我想我知道我的错误是什么:我的猜测是将404

与ErrorDocument信息一起发送给客户端,然后

客户端发送另一个请求ErrorDocument的请求,附加了

初始请求 - 而我最初认为它本身就是Apache本身

使用该指令来处理请求。如果我猜对了,那对我来说是个坏消息:(


Bartek


-

#!/ usr / bin / env python

print''sygnatura''



Yes I did, but I think I know what was my mistake: my guess is that the 404
is sent to the client together with the ErrorDocument information, then the
client sends another request asking for ErrorDocument, attaching the
initial request - while I initially thought that it is Apache itself that
uses the directive to handle the request. If my guess is right, that would
be a VERY bad news for me :(

Bartek

--
#!/usr/bin/env python
print ''sygnatura''


在我们的上一集,

< cv ********** @ atlantis.news.tpi.pl> ;,

可爱而有才华的Taki Jeden
www.authoring.html: < br>
In our last episode,
<cv**********@atlantis.news.tpi.pl>,
the lovely and talented Taki Jeden
broadcast on comp.infosystems.www.authoring.html:
Jukka K. Korpela写道:
Jukka K. Korpela wrote:
Taki Jeden< ba ******** *@interia.pl>写道:
Taki Jeden <ba*********@interia.pl> wrote:
有谁知道为什么w3c验证器无法获取使用404
htaccess重定向的页面?
Does anybody know why w3c validator can not get pages that use 404
htaccess redirection?


请求的资源不可用。否则客户端处理它是不正确的。



There is no such thing as 404 redirection. HTTP code 404 means that the
requested resource is not available. It would be incorrect for a client to
treat it otherwise.

我设置了两个网站,以便客户端请求不存在的网址,但是htaccess会将调用重定向到一个脚本,该脚本会解析网址并生成请求的网页。
I set up two web sites so that clients request
non-existent urls, but htaccess redirects calls to a script which
parses the url and produces requested pages.



然后不要这样做。 (我们真的不知道你在做什么细节,但很明显这是错的。)
你不知道我在做什么,但是你知道这是错的吗?凉。
我的.htaccess文件是这样的:
ErrorDocument 404 /script.php
每当你请求一个不存在的页面时,你的请求由'/'脚本处理.PHP'。它有效 - 例如,查看 www.safetycam.pl


难怪你遇到了问题。 404表示未找到。

ErrorDocument指令允许您向用户显示

一个有吸引力的人类可读页面,用于未找到。消息。

这仍然是一个错误,这就是为什么它被称为* ErrorDocument *

,消息是未找到。

当然,那些自定义404文档的人经常会验证它,但是他们会在*指向ErrorDocument

之前这样做。



Then don''t do that. (We don''t really know what you do in detail, but it is
pretty clear that it''s wrong.) You don''t know what I''m doing, but you know it''s wrong? Cool. My .htaccess file is like this: ErrorDocument 404 /script.php Every time you request a page that is not there, your request is handled by
the ''script.php''. It works - check out www.safetycam.pl, for example.
Little wonder you are having problems. 404 means "Not found."
The ErrorDocument directive allows you present the user with
an attractive human-readable page for the "Not found" message.
It is still an Error which is why it is called *ErrorDocument*
and the message is "Not found."

Of course people who do customize their 404 document often
do validate it, but they do so *before* pointing ErrorDocument
at it.

它适用于浏览器,



浏览器是众所周知的有错误。



Browsers are known to have bugs.



正确 - 所以请致电Mozilla和Firefox的人,告诉他们他们的浏览器有一个严重的错误:)(和微软,课程)


当然,这个错误存在于你的大脑中。无论你拥有什么?

认为404不是错误?


但是当我尝试验证页面时出现404错误 - 其中<令我感到困惑,因为我认为Apache在内部进行了重定向而没有向客户端发送错误消息。
你做到了吗?好吧,我们知道发生了什么事的可能性更小,因为你没有透露URL,更不用说明你在.htaccess
文件中显示的内容了。


Right - so please call the Mozilla and Firefox guys, tell them their
browsers have a serious bug :) (and Microsoft, of course)
The bug, of course, is in your brain. Whatever possessed you to
think that 404 was anything other than an error?

but when I try to validate the page I get a 404 error - which
bewilders me, because I thought Apache does the redirection internally
without sending the error message to the client.
You did? Well, we have even less odds of knowing what''s going on, since
you don''t reveal the URL, still less show what you have in the .htaccess
file.



我做了,但我想我知道我的错误是什么:我的猜测是将404
与ErrorDocument信息一起发送给客户端,然后<客户端发送另一个请求ErrorDocument的请求,附加了
初始请求 - 而我最初认为是Apache本身使用该指令来处理请求。如果我的猜测是正确的,那对我来说将是一个非常坏的消息:(


Yes I did, but I think I know what was my mistake: my guess is that the 404
is sent to the client together with the ErrorDocument information, then the
client sends another request asking for ErrorDocument, attaching the
initial request - while I initially thought that it is Apache itself that
uses the directive to handle the request. If my guess is right, that would
be a VERY bad news for me :(




Apache发送404然后发送文件会发生什么。

导致许多代理商,尤其是搜索蜘蛛等机器人,以及

,如您所发现的,验证机器人当场注销。

毕竟ErrorDocument的想法是为人类提供一个人类可读的线索,告诉他们发生了什么 -

如果一个人没有操作就毫无意义客户端。


Apache向自己发送404没有任何意义。它知道

文件不存在。它不能替代ErrorDocument

是一个不存在的文件,但只能用它替换它自己的

内置而非普通的错误文档。


-

Lars Eighner ei*****@io.com < a rel =nofollowhref =http://www.io.com/~eighner/target = _blank> http://www.io.com/~eighner/

拯救热带雨林!吃素食!



What happens is Apache sends 404 and then the document. The 404
causes many agents, especially bots such as search spiders and,
as you have discovered, validation bots to sign off on the spot.
The idea of the ErrorDocument after all is to provide the human
with a human-readable clue as to what has happened - something
that is pointless if a human is not operating the client.

There is no point in Apache sending 404 to itself. It knows the
document isn''t there. It does not substitute the ErrorDocument
for a non-existing document, but only substitutes it for its own
built-in rather plain not-found-error document.

--
Lars Eighner ei*****@io.com http://www.io.com/~eighner/
Save the Rainforest! Eat a vegetarian!


这篇关于使用404 htaccess重定向进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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