by Dinesh Thakur

The word "code" has two meanings in operation of computers. The first one is Number or Symbol that representing another meaning. An example of this type of code is "301", which is a code specified in the HTTP to signify. The 301 redirect is the most effective way for you to change the content of a page or site to another without losing the PageRank of the page and the domain that migration. Discover all you need to know to migrate page or domain without losing position in Google. The other meaning of "code" in computing is "programming code" a "permanent redirection". PHP is a programming language for web pages. You can use the PHP code to create a redirect. Redirection redirect or forwards visitors to a web address to another Web address, usually because the original page changed its address. The user is automatically forwarded to the new page location, and usually do not even notice that the address on the top of the browser has changed.

Hypertext Transfer Protocol

The HTTP specification contains a list of status codes. All web servers and Web browsers to know these codes. The code 301 means "Permanent Redirect" and the code 302 means "temporary redirect." An HTTP message contains a section called "headers" and a message body. When a web server responds to a request for a redirected page, it sends a simple message with an empty body. One of the HTTP headers will contain the redirect code, or 301 or 302, and the new page address. The web browser knows that when it receives such a message, must reapply immediately to the page with the new address.


PHP is a programming language that generates web pages. The language contains a number of functions, one of which is "header ()". The function header has two shapes. Receives an HTTP code phrase as a parameter, the other has a "Local" parameter, which is a function that creates a redirect. A PHP program file must exist at the site of the old page, and the request arrives will only activate this program, if the page was generated by a PHP program with the same name.

Coding for Code

The header function creates a 302 redirect by default if no HTTP code was created before being called to the "Local" parameter. The value for the location parameter is the new address for the page. A 301 redirect is required, the function must be written twice: once to create the 301 code for the function and then again to implement the redirection with the parameter location. This PHP code simply requests that the Web server to send an HTTP code, or 301 or 302.