Help: If isset query_string return 404
- From: wd <n23@xxxxxxxxxxxxxx>
- Date: Tue, 17 Jan 2006 01:23:24 -1000
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 .com?p=chair
they would get a 404...
But if they request
www. my_site .com/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>>>;
}
.
- Follow-Ups:
- Re: If isset query_string return 404
- From: Kimmo Laine
- Re: If isset query_string return 404
- From: d
- Re: If isset query_string return 404
- Prev by Date: Re: using heredoc for SQL statements
- Next by Date: Sending an array from a form
- Previous by thread: Small php 5 library
- Next by thread: Re: If isset query_string return 404
- Index(es):
Relevant Pages
|