Use a Redirect Script in PHP

This article walks you through the process of using a 301 redirect script in PHP.  The 301 redirect  is a very efficient method of webpage redirection.  More importantly, it is search engine friendly.  

In order to utilize a 301 redirect, you will need to add the following PHP code to a page on your site (replacing http://www.domainname.com with the actual destination URL):

<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.domainname.com" ); 
?>

In most cases, you will need to insert this script on a default document such as index.php or default.php in order to redirect a fully-qualified domain name.

NOTE: This script can be inserted in your web root or a sub-directory.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing htop

htop is an interactive process viewer for Linux, which is a powerful alternative to the...

Bind Multiple IP Addresses to a Single Network Interface Card (NIC)

This tutorial demonstrates how to bind multiple IP addresses to a single NICI'll be using LAN...

Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any...

Set the time on a Linux server

Log into the server via SSHAt the shell prompt run the following command:date MMDDHHmmYYYYFor...

Check your disk usage in Linux

A good way to check your disk usage for folders on your Linux server is via shell.Download...