如果带有查询字符串的网址是 ,我希望我的服务器发送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
发布评论