I'm trying to do a php 301 redirect. this is the entire html I am using. I keep getting Warning: Cannot modify header information - headers already sent by (output started at /home/content/D/w/a/DwayneAMG/html/eurekaclassifieds/index.php:4) in /home/content/D/w/a/DwayneAMG/html/eurekaclassifieds/index.php on line 5 Any ideas? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <?php // Permanent redirection header("HTTP/1.1 301 Moved Permanently"); header("Location: http://classifieds.norcalcars.com/"); exit(); ?> </head> <body> </body> </html> PHP:
You can't have any output before the Location header is sent, meaning you can't send anything to the browser before the header() call like you are doing. Will work: <?php // Permanent redirection header("HTTP/1.1 301 Moved Permanently"); header("Location: http://classifieds.norcalcars.com/"); exit(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> </head> <body> </body> </html> PHP:
Thanks I've been trying to use NVU as my editor. It wouldn't allow this. Edited it in textpad and that worked Thanks Again.