How To Create A PHP Header Redirect In C-Panel

How To Create A PHP Header Redirect #

 

Redirecting to another website #

To set up a simple redirect in PHP you will need to create a header() function. Simply create an index.php file in the location you want to redirect from with the following line of code:

< ?php header(“Location: https://URL-YOU-WANT-TO-REDIRECT-TOO/”); ?> #

This will now redirect to the website location you typed.

 


Redirecting to another page or directory #

You can also create a file that links internally on your file manager.

<?php header(“Location: anotherDirectory/anotherFile.php”); ?> #

When linking to an internal file it doesn’t have to match a .php extension, It can be the following programs python, HTML, PHP, Perl, CGI and compiled CGI programs.

 

[rev_slider alias=”Conor-Bradley-Digital-Agency-knowledge-base-bottom-footer”][/rev_slider]

                                             Facebook | Twitter | Instagram | Youtube | Vimeo | Blog | Knowledge Base

Updated on November 17, 2020