Jump to content

Redirect Page Problem


fazlionline

Recommended Posts

Hello allI have a link on my site for a blog.when that page opens it have a redirect script for a blog in other websitebut when i clik on blog linke the page opens but do not redirect to other page and give this error:

Warning: Cannot modify header information - headers already sent by (output started at d:\Customers\user1092190\www\v2\blog\blog.php:9) in d:\Customers\user1092190\www\v2\blog\blog.php on line 10
my script is this
<?phpheader( 'Location: http://www.fazlionline.com/wordpress/' );?>

note: i have past this script in the main body tagis there any rule to put the redirect in a special place?Thanks

Link to comment
Share on other sites

yes there is problem.you need to insert the rederection code on top of the page. i mean above all html codes (above <html> root tag). Then it will work. you need to insert headers before any out put statements. if you have echo or print statements insert the header above them also.output statements (echo , print ,etc )or any html output will be sent in the http body. header are sent in the http header. so u need to insert them before any output statement.it is like using session_start() statement.insert it above everythingeg:<?phpheader( 'Location: http://www.fazlionline.com/wordpress/' );?><html><head></head><body></body></html>

Link to comment
Share on other sites

In fact, if you're going to use redirection, there's no point in even outputting anything, since the user is not going to see it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...