My goal: redirect www.innovationzen.com to innovationzen.com I inserted the following code right at the top of the header.php _______________________ <?php if ($_SERVER['HTTP_HOST'] == "www.innovationzen.com") { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://innovationzen.com".$_SERVER['REQUEST_URI']); exit; } ?> ____________________________ However the redirect is not working, when i hit www.innovationzen.com I get the following: "The document has moved here. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request." Does anyone know what is wrong with the redirect? thanks
i need to do a php redirect becayse my host (yahoo) does not support .htaccess I know it sucks but I am trying to set up the php before taking the more drastic action of changing host
Not tested. Move exit; outside the if statement. <?php if ($_SERVER['HTTP_HOST'] == "www.innovationzen.com") { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://innovationzen.com".$_SERVER['REQUEST_URI']); } exit; ?> Code (markup): Oh, and remove the empty line at the start. It matters in the header. cheers, gary
solved the problem with a nice plugin for wordpress you can find it here http://txfx.net/code/wordpress/enforce-www-preference/