Hey people, I need to make 1 php page which redirects to my page. Ne help would be highly appreciated. Thanx. Admans. P.S : i dont want html based page. I want only .php page which when visited redirects to page on my site.
<?php header("Location: http://www dot yoursite dot com/"); ?> or print '<script language="Javascript" type="text/javascript"> <!-- Hide script //<![CDATA[ window.location.href="http://www dot your site dot com/" //]]> End script hiding --> </script>';
The only safe way to handle redirects is to 301 them. Scripted redirects are commonly used by spammers so be VERY careful
If you want to do a 301 redirect with PHP, you need to add the proper header() function. For example: <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.digitalpoint.com/"); ?> PHP:
And done as shawn posted, you will not be here in a few months asking 'where did my site go' am I banned by Google Yahoo! etc
Thanx a lot people.....really helpfull personalities here...5 stars to this forum..long live DP....okz okz..m getting little too excited Newayz..thanx all for help me out. I am gonna do the permanent redirect. Again. Thanx all. Admans.
Im getting error on this : Warning: Cannot modify header information - headers already sent by (output started at xxcxxxxxxxxxxxxxxxx/board/index.php:1) in xxxcxxxxxxxxxxxxxxxx//board/index.php on line 3 Sorry for that post in bold.
Put the redirection code before anything that will spit anything out to the end user (before any echo, print, etc. functions). Once your script outputs anything to the end-user's browser, the headers have already been sent and cannot be set.
You can use output buffering so that you can decide when the headers get sent. That way you can still use redirects even if you are halfway through your page. John