|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-19 13:23 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 05:00:01 2025 UTC |
Description: ------------ Hi, while using a constant for defining a hyperlink-target (http-adress) and using this constand to do a header();redirect there comes an object not found-error (404) in the browser. The reason is that php could not interpret the value of the constant and using the constants name for the header();-function. Reproduce code: --------------- Not working code: <?php define('HOME', 'http://www.google.de'); header("Location: HOME"); ?> WORKING CODE: <?php define('HOME', 'http://www.google.de'); $home_var = HOME; header("Location: $home_var"); ?> Expected result: ---------------- I expected a redirct to the defined value of the constant, in this example 'http://www.google.de'. Actual result: -------------- The browser is redircting to /HOME using the actual url of the page and just adding /HOME (which is the name of the constant, not the value) in the end of the adress bar.