Skip to content
Help Center

PHP redirect: how to redirect your website using PHP

A basic explanation of how PHP redirection works and when it makes sense to use it.

PHP can be used to redirect visitors from one page to another.

A basic redirect looks like this:

\header("Location: /new-page");\

After sending the header, it is also good practice to stop execution:

\exit;\

When PHP redirects are useful

  • redirecting after a form submission
  • sending users to a new internal page
  • controlling redirects based on conditions in your application

Important note

If you are moving pages permanently for SEO reasons, server-level redirects such as Apache rules are often a better choice than application-level redirects.