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 NameHero 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.namehero.com"); ?>
Obviously you would want to replace https://www.namehero.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!