帮助:如果isset query

编程入门 行业动态 更新时间:2024-10-18 14:16:06
本文介绍了帮助:如果isset query_string返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果带有查询字符串的网址是 ,我希望我的服务器发送404标头。因此,如果浏览器或蜘蛛请求 像 www。 my_site ?p =主席 他们会得到404 ... 但如果他们要求 www。 my_site / chair.htm 一切都会正常。 有了一些帮助,这是我到目前为止所做的,但是它没有工作 正确。它总是显示404,即使URL中没有问题 标记。此外,我希望该页面在HTML>>>之后停止显示任何内容 如果它发送404错误,但我不知道怎么做 it: if(isset($ _ SERVER [" QUERY_STRING"])){ header(" HTTP / 1.0 404 Not Found"); echo<<< HTML < ; head> < title> 404 Not Found< / title> < / head> < body> < h1>未找到< / h1> 在此服务器上找不到请求的网址。 < / body> < / html> HTML>>> ;; }

解决方案

_SERVER [" QUERY_STRING"])){ header(" HTTP / 1.0 404 Not Found"); echo<<<< HTML < head> < title> 404 Not Found< / title> < / head> < body> < h1>未找到< / h1> 在此服务器上找不到请求的URL。 < /正文> < / html> HTML>>> ;; }

" wd" < n2*@nospam.invalid>在留言中写道 news:pa **************************** @ nospam.invalid ... 如果请求带有查询字符串的URL,我希望我的服务器发送404标头。因此,如果浏览器或蜘蛛请求像 www。 my_site ?p =主席他们会得到404 ...... 但如果他们要求 www。 my_site / chair.htm 一切都很正常。 有了一些帮助,这是我到目前为止所做的,但是它没有正常工作。它总是显示404,即使URL中没有问题标记。此外,我希望该页面在HTML>>>之后停止显示任何内容。如果它发送404错误,但我不知道怎么做它: if(isset(

_SERVER [" QUERY_STRING"])){标题(" HTTP / 1.0 404 Not Found"); echo<<< HTML < head> < title> 404 Not Found< / title> < / head> < body> < h1>未找到< / h1> 请求的网址在此服务器上找不到。< / body> < / html> HTML>>> ;; }

那是因为

I want my server to send a 404 header if a URL with a query string is requested. So if a browser or spider requests something like www. my_site ?p=chair they would get a 404... But if they request www. my_site /chair.htm everything would be normal. With some assistance this is what I have so far, but it isn''t working correctly. It always displays the 404, even when there is no question mark in the URL. Also, I would like the page to stop displaying anything after the "HTML>>>" if it sends the 404 error, but I''m not sure how to do it: if (isset($_SERVER["QUERY_STRING"])) { header("HTTP/1.0 404 Not Found"); echo <<<HTML <head> <title>404 Not Found</title> </head> <body> <h1>Not Found</h1> The requested URL was not found on this server. </body> </html> HTML>>>; }

解决方案

_SERVER["QUERY_STRING"])) { header("HTTP/1.0 404 Not Found"); echo <<<HTML <head> <title>404 Not Found</title> </head> <body> <h1>Not Found</h1> The requested URL was not found on this server. </body> </html> HTML>>>; }

"wd" <n2*@nospam.invalid> wrote in message news:pa****************************@nospam.invalid ...

I want my server to send a 404 header if a URL with a query string is requested. So if a browser or spider requests something like www. my_site ?p=chair they would get a 404... But if they request www. my_site /chair.htm everything would be normal. With some assistance this is what I have so far, but it isn''t working correctly. It always displays the 404, even when there is no question mark in the URL. Also, I would like the page to stop displaying anything after the "HTML>>>" if it sends the 404 error, but I''m not sure how to do it: if (isset(

_SERVER["QUERY_STRING"])) { header("HTTP/1.0 404 Not Found"); echo <<<HTML <head> <title>404 Not Found</title> </head> <body> <h1>Not Found</h1> The requested URL was not found on this server. </body> </html> HTML>>>; }

That''s because

更多推荐

帮助:如果isset query

本文发布于:2023-11-01 12:54:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549388.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:isset   query

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!