[2847 views]
Redirect in PHP or any other programming language means transfer user from one page of the website to another or to forward URLs (uniform resource locator). It is mostly used to specify old traffic of a website should be transferred to another URL.
It is also used to transfer users and search engine to another URL from the original URL. There are three types of redirects:-
It shows to the search engine that the page has moved permanently. It is used when you transfer your whole website to another domain.
It is used for the temporary transfer of pages, URL or website for example when we need some maintenance on our website. It is used for a temporary basis.
It is used to instruct a web browser to load the current web page after a specific counter of time automatically, for example: to transfer one page to another with a specific time frame.
To transfer one page to another in PHP 3 basic ways are used-
Using header function
By Meta Refresh
By Javascript
Header function is a built-in function in PHP and it sends an HTTP header to a client or browser. When a web page is requested server sends the header function along with some additional details such as URL date, request date, etc. It is very important to know that the header function always calls before output.
Syntax:
It is used to instruct a web browser to load the current web page after a specific counter of time automatically.
Syntax:
Syntax:
the Browser is successfully redirected to http://www.example_site.com