PHP Redirect

February 7, 2012 6:21 pm Published by Leave your thoughts

PHP Redirect to Self (refresh)

Header('Location: '.$_SERVER['PHP_SELF']);
Exit(); // if more than one header, you will get "header already sent" error if don't exit out

PHP Redirect to other page

header( 'Location:' ) ;

Why you should avoid using javascript redirect?

A : Due to Google’s redirect penalty.

Update on Google penalty (04/17/16):

Tags: , , ,

Categorized in:

This post was written by hackya