---
title: "How To Create A PHP Header Redirect In C-Panel"
description: "# 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…"
url: "https://staging2.conorbradley.co.uk/kb/php-header-redirect/"
updated: "2022-05-05"
category: "Using C-Panel (Control Panel)"
tags:
  - Header
---

# 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.

 

                                             [Facebook](https://www.facebook.com/conorbradleydigitalagency) | [Twitter](https://twitter.com/ConorAgency) | [Instagram](https://instagram.com/conorbradleydigitalagency) | [Youtube](https://youtube.com/conorbradleydigitalagency) | [Vimeo](https://vimeo.com/conorbradleyagency) | [Blog](https://staging2.conorbradley.co.uk/blog/) | [Knowledge Base](https://staging2.conorbradley.co.uk/kb/)
