Home arrow PHP arrow Page 3 - How to Redirect URLs in PHP

Refresh Redirects in PHP - PHP

In this programming tutorial, we will look at different methods to redirect URLs in PHP. Specifically, we will be examining 301 URL redirect methods via code, meta refresh and the use of PHP header location settings to invoke a redirection.

TABLE OF CONTENTS:
  1. How to Redirect URLs in PHP
  2. Permanent URL 301 Redirect in PHP
  3. Refresh Redirects in PHP
By: Codex-M
Rating: starstarstarstarstar / 3
April 27, 2011

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Another type of redirect is the refresh type of redirect. This is easily done in HTML as a meta refresh redirect. In PHP, you can do this as follows:

<?php
header("refresh:5;url=http://www.example.org/targeturl.php");
echo 'You\'ll be redirected in about 10 secs. If not, click <a href="
http://www.example.org/anotherurl.php">here</a>.';
?>

This is not a search engine friendly redirect and along with 302 redirection, it should not be used for SEO purposes. The only thing that is acceptable to most search engines including Google is the 301 redirect.



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 



© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap

Dev Shed Tutorial Topics: