B2B Articles
October 17, 2010
By:Ironpaper

PHP 301 Redirect Code

Here is how to use PHP to create a permanent 301 redirect. This type of redirect tells user-agents that the webpage has moved permanently to the new, referenced location. Using 301 redirects can be a vital part of a search engine optimization (SEO) practice.

In order to use this code properly, you will need to place the PHP snippet above all content on the page. By placing the PHP 301 redirect code within or below other content will result in an error like the following: Warning: Cannot modify header information - headers already sent by...

<?php
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: https://test.com" );
?>

Please note: Replace "https://test.com" with your new location for the webpage.

Interested in working for or partnering with Ironpaper? We’d love to hear from you.
We are passionate about helping remarkable companies grow. We solve challenges that hold businesses back. We love it. 
Connect with Us