"No1" <cccccccccc@nonexisting.doooooomain.com> writes:
> Og du gider ikke at rette det?
Nej, jeg forventer da at folk der laver den slags også har læst den
pågældende RFC. Det var tydeligvis for meget at forvente.
> header("HTTP/1.0 301 Moved Permanently");
Den ville jeg ikke bruge i dette tilfælde.
> header("Location: ".$_GET['kanal'].".html");
Afsnit 14.30 i RFC 2616 siger:
,----[ Afsnit 14.30 af RFC 2616 ]
| 14.30 Location
|
| The Location response-header field is used to redirect the recipient
| to a location other than the Request-URI for completion of the
| request or identification of a new resource. For 201 (Created)
| responses, the Location is that of the new resource which was created
| by the request. For 3xx responses, the location SHOULD indicate the
| server's preferred URI for automatic redirection to the resource. The
| field value consists of a single absolute URI.
|
| Location = "Location" ":" absoluteURI
|
| An example is:
|
| Location:
http://www.w3.org/pub/WWW/People.html
|
| Note: The Content-Location header field (section 14.14) differs
| from Location in that the Content-Location identifies the original
| location of the entity enclosed in the request. It is therefore
| possible for a response to contain header fields for both Location
| and Content-Location. Also see section 13.10 for cache
| requirements of some methods.
`----
Og absoluteURI er kort defineret som:
,----[ Uddrag af afsnit 3.2.1 af RFC 2616 ]
| 3.2.1 General Syntax
|
| URIs in HTTP can be represented in absolute form or relative to some
| known base URI [11], depending upon the context of their use. The two
| forms are differentiated by the fact that absolute URIs always begin
| with a scheme name followed by a colon. For definitive information on
| URL syntax and semantics, see "Uniform Resource Identifiers (URI):
| Generic Syntax and Semantics," RFC 2396 [42] (which replaces RFCs
| 1738 [4] and RFC 1808 [11]). This specification adopts the
| definitions of "URI-reference", "absoluteURI", "relativeURI", "port",
| "host","abs_path", "rel_path", and "authority" from that
| specification.
`----
Se evt. selv de RFC'er der henvises til. Derfor må den rette måde
være:
header("Location:http://" $_SERVER['HTTP_HOST'] .
dirname($_SERVER['SCRIPT_NAME']) . $_GET['kanal'].".html");
Det kan jo let pakkes ind i en funktion, der bare tager $_GET['kanal']
som argument, hvis man synes ovenstående er grimt.
I øvrigt bør man naturligvis også checke om $_GET['kanal'].".html"
findes, og må vises for den pågældende bruger.
Nu du er igang med at læse RFC'er, kan du så ikke også læse RFC 2606
med henblik på hvilket domænenavn du bruger i din emailadresse. Den er
ikke ret lang, så det skulle være til at overkomme.
--
Jacob -
www.bunk.cc
Today is the tomorrow you worried about yesterday.