Divi WordPress Theme

Topic: 302 Redirect using PHP - temporary redirections  (Read 25971 times)

Offline Kevin

  • Junior Guru
  • **
  • Posts: 72
  • iTrader: +4/-0
    • View Profile
302 Redirect using PHP - temporary redirections
« on: August 10, 2008, 04:06:37 PM »
Sometime, you may need to redirect your site to some other location. In such event, you may set 302 redirection (also called temporary redirection) using PHP code. Following is the sample 302 redirection using PHP:

Code: [Select]
<?php
header
("Location: http://www.your-web-site.com/temp-location/index.html");
exit();
?>


Kevin
« Last Edit: August 20, 2014, 05:39:10 PM by Kailash »
VPS Hosting - AccuWebHosting

Offline muckle.martin

  • Newbie
  • *
  • Posts: 5
  • iTrader: +0/-0
    • View Profile
Re: 302 Redirect using PHP - temporary redirections
« Reply #1 on: December 14, 2008, 01:11:42 PM »
Ignore my last message :)

Quote from: Kevin
Sometime, you may need to redirect your site to some other location. In such event, you may set 302 redirection (also called temporary redirection) using PHP code. Following is the sample 302 redirection using PHP:

Code: [Select]
<?php
header
(”Locationhttp://www.your-web-site.com/temp-location/index.html”);
exit();
?>


Kevin
« Last Edit: October 26, 2012, 07:14:44 PM by Kailash »

Offline ramsankeiio

  • New Member
  • *
  • Posts: 15
  • iTrader: +0/-0
    • View Profile
Re: 302 Redirect using PHP - temporary redirections
« Reply #2 on: October 15, 2010, 02:04:27 PM »
Sometime, you may need to redirect your site to some other location. In such event, you may set 302 redirection (also called temporary redirection) using PHP code.

Offline Web_news

  • New Member
  • *****
  • Premium Member
  • Posts: 44
  • iTrader: +5/-0
    • View Profile
Re: 302 Redirect using PHP - temporary redirections
« Reply #3 on: August 11, 2014, 07:10:19 PM »
If you have Apache web server with mod_rewrite support, you can also use following .htaccess rule for 302 redirection:

Redirect 302 /old_path new_rul_location

Example:

Redirect 302 /index.htm http://your_website/index.php
Shopify Divi WordPress Theme
Tags: