Knowledgebase

How To Create A PHP Redirect

How To Create A PHP Redirect

Have you ever had the need to redirect and old php page to a new one?

I know it happens to me all the time!

Just today, one of our support supervisors let me know we had an old page still live on the AppsGators website that displayed some very outdated pages.

While for SEO purposes, I'll still update our .htaccess to reflect the 301 moved permanently, the quick fix was replacing the file with a PHP redirect:

<?php 
header("Location: https://www.AppsGators.com");
?>

Obviously you would want to replace https://www.AppsGators.com to the URL you're wanting to redirect too.

How To Create A PHP Redirect In cPanel

The fastest way to get this added is through cPanel -> File Manager:

Once inside you need to navigate to your public_html directory where all your public-facing files live:

Double click on that directory and then create or edit the PHP file where you want to place the redirect:

Save the file and you're all set!

PHP Redirect Tutorial

 

I've filmed a video where I show how exactly to set this up:

As stated in my video, this is probably one of my "most used" things in all 20 years working online!

Personally, I made this blog post so I can always reference it, to quickly copy and paste the code when I need it.

I hope you'll find it as valuable for you and your customers (for our Resellers).

Feel free to ask any questions below!

 
Was this answer helpful?

Related Articles

How To Move Your Website From HostGator

How To Move Your Website From HostGator On average, we move around 5 - 10 customers a...

How To Install And Setup Ali Plugin For AliExpress.com

How To Install And Setup Ali Plugin For AliExpress.com This is the second part to my...

How To Make Money With A Discussion Forum

How To Make Money With A Discussion Forum People like to connect with other people who...

How To Make Money With AliExpress In 2017

How To Make Money With AliExpress In 2017  Last year, I filmed a tutorial on How To...

How To Change Your PHP Version And Add Extensions Inside cPanel

How To Change Your PHP Version And Add Extensions Inside cPanel At AppsGators we...