Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me

PHP Redirect

David Carr

Tutorials PHP & MySQL

Tutorial on PHP redirect to be redirected to another page or web site

For this tutorial lets suppose you have moved your web site to another domain and want your visitors to be redirected to your new domain you can use PHP for this purpose.

Here is the code to redirect a user:


Here's a breakdown of the code.

The <?php tells the browser to expect to receive php.

header ('Location: ''); tells the browser to redirect to the address given in the code and ?> tells the browser to finish expecting PHP.

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!


My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.