How to redirect a URL permanently in PHP?
by
Anuj Kumar
|
<?php // Permanent 301 Redirect via PHP header("HTTP/1.1 301 Moved Permanently"); header("Location: http://domain.tld/new/location/"); exit(); ?> |
The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the requested resource has been definitively moved to the URL given by the Location headers. A browser redirects to the new URL and search engines update their links to the resource.
Tags: How to redirect a URL permanently
Anuj Kumar
Hi! I am Anuj Kumar, a professional web developer with 5+ years of experience in this sector. I found PHPGurukul in September 2015. My keen interest in technology and sharing knowledge with others became the main reason for starting PHPGurukul. My basic aim is to offer all web development tutorials like PHP, PDO, jQuery, PHP oops, MySQL, etc.
Apart from the tutorials, we also offer you PHP Projects, and we have around 100+ PHP Projects for you.
Recommended Tutorials for you...
You may also like...