| deflated |
12-29-2007 05:06 PM |
Quote:
Originally Posted by exorcist
(Post 7256)
When i open my page without www, like Domain.com in IE, images dont display, only when i type it with www infront...
|
Are you suppressing warnings? Perhaps your header() has just failed. Could you copy the following code into your file directly before the if() construct and post the response here?
PHP Code:
//...
//firstly we check if there's already been output if (headers_sent($file, $line)) { //okay, that was simple: the problem is that header() failed //now find out where the first output has been made echo 'Headers already sent in "' . $file . '" in line "' . $line . '"' . PHP_EOL; } else { //substr ( $_SERVER['SERVER_NAME'], 0, 4 ) seems to be "www." var_dump ( $_SERVER['SERVER_NAME'] ); echo PHP_EOL; var_dump ( substr ( $_SERVER['SERVER_NAME'], 0, 4 ) != 'www.' ) ); print_r ( $_SERVER ); }
die();
//...
You could also try to replace "location" by "Location" so that it looks like:
PHP Code:
header('Location: http://www.example.com/');
Perhaps that's been an Internet Explorer specific problem. Have you already other browsers like the Mozilla Firefox or Opera?
Why do you redirect at all? Even better is to use a function which returns the URL to your script without the scriptname itself (You could also use a variable but functions can be used in different parts of your code - okay you could use the global/static keyword for that but I prefer functions or Singleton classes). So when you want to use an image just add getUrl() before the filename.
|