In this php trick, I will show you two ways to make redirections. The first will be in PHP using the header function and the second one will use the URL Rewriting using the .htaccess file.
This way is dynamic because you can execute a php code before. Be sure that there is no (X)html code or any echo before the redirection:
You only have to change http://www.webestools.com by the URL of the destination page.
This way use URL Rewriting, so you have to create a .htaccess file and he must contain the following code in the beginning:
That will activate the URL Rewriting. In the following code, when someone go to mypage.html, he will be automatically be redirected to mypage2.html:
RewriteRule ^mypage\.html$ /mypage2.html [R]
You have to add the code above in you .htaccess file. mypage.html don't need to realy exist in the server to make the redirection.
I hope this trick will be useful.
Similar Scripts and Tutorials