A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo.com in the browser automatically transfers the user to another URL bar.com.
The PHP Redirect command:
Replace [some-url] with the URL where you want the redirection to take place.
For example,
header("location: ./version2/index.html"); =>redirect to "index.html" page in subfolder called "version2"
header("location: http://www.yahoo.com"); =>redirect to a website called yahoo.com
If PHP is not available, it's also possible to use other redirects:
* HTTP Redirects
Replace [time] with seconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.
For example,
The above HTTP based redirect needs to be in the region of the HTML code.
* JavaScript Redirects
setTimeout("location.href='[some-url]'", [time]);
Replace [time] with milliseconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.
For example, setTimeout("location.href='http://www.yahoo.com'", 5000);
The above JavaScript based redirect can be either in the or region of the HTML code.
Usually a PHP redirect is much more reliable than other form of redirects like HTTP redirect or JavaScript based redirects. For example a JavaScript redirect may not work if a user's browser settings has JavaScript turned off.
The reason why PHP redirects will work no matter what settings users have on their browser is because PHP is server side script. It will not depend on browser settings that may affect JavaScript which is parsed on the client-side/user-side.
About the Author
Sanjib Ahmad, Freelance Writer and Product Consultant for http://www.marc8.com.
You are free to use this article in its entirety as long as you leave all links in place, do not modify the content, and include the resource box listed above.
There are many different traffic analysis tools, ranging from simple... Read More
If you're looking for better web site ROI, chances are,... Read More
Are you aware that 90% of the websites on the... Read More
This article was prompted by some customer support work I... Read More
"'Page Not Found' on this Server. Check the URL and... Read More
Better Web Site ROIHow to increase your business profitability by... Read More
Psychology is a long word which everyone thinks, "no, that's... Read More
Is your website Really useful?I had a 'rep' in yesterday... Read More
When you purchase a new item from a Yahoo! Store,... Read More
You want to give your site's visitors a way to... Read More
Many websites I come across don't have a single link... Read More
That's right. Your method, behavior and strategy you are now... Read More
Anyone who knows anything about web accessibility knows that images... Read More
An additional benefit of website accessibility is an improved performance... Read More
Rosalind wants to share her inspirational poetry with a wider... Read More
If you ever want to create a state directory, article... Read More
What is the point of having a website, you may... Read More
After having decided to start a business, the next thing... Read More
In the time that I have been using the Internet,... Read More
Q. Hey, Cathy: I'm just setting up a website. What... Read More
As a business you can't afford to ignore the Internet... Read More
Are you, like many other website owners, frustrated at the... Read More
An Introduction to Server Side IncludesBeginner? That's OK!While much has... Read More
No matter what browser you may want to use, you... Read More
Knowledge is power.And undoubtedly, it is the key to making... Read More
The Disability Discrimination Act states that service providers must not... Read More
SiteSpinnerSiteSpinner is a user-friendly web site development tool that includes... Read More
You work hard to build traffic to your web page.... Read More
There are millions and millions of websites on the Internet.... Read More
There is an ongoing debate about web copy. Some say... Read More
Some left shoes are in isle 5, while the right... Read More
Launching a new small business website is often a long... Read More
1. The first page appears quickly.It's a good way to... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
When you take a look at the most visited sites... Read More
1) Data CaptureOne easy way to collect e-mail addresses and... Read More
In the time that I have been using the Internet,... Read More
There have been many significant changes to the face of... Read More
Why do some sites succeed while the vast majority of... Read More
Your web site will be your window to the world.... Read More
Internet has opened a whole new world for web developers... Read More
"What's in it for me?" you ask. "Why should I... Read More
Customer service questionnaires can help your clients better understand their... Read More
One of the most useful features offered by some web... Read More
What is SQL? SQL stands for Structured Query Language and... Read More
If you are looking for creating your online presence you... Read More
A common dilemma most small and medium businesses face when... Read More
Understanding and using web analytics.In recent years, website marketers were... Read More
In 1995 a new era of accessibility for disabled people... Read More
Many web developers today are starting to KISS their website,... Read More
In the late 1990's three San Francisco based web developers... Read More
When I started my company in 2002, I knew I... Read More
Build it and they will come is not always true;... Read More
A website is the most versatile and cost-effective marketing tool... Read More
I am just a learner who likes to delve in... Read More
You know exactly what your organisation does and what your... Read More
Setting up a website is the very first step of... Read More
Many small businesses have the misconception that their business can... Read More
You want to give your site's visitors a way to... Read More
Having an eye catching website is great, but are you... Read More
Developing a website with content that entices visitors to return... Read More
Project Safekids provides webmasters a valuable tool which could save... Read More
What is web accessibility & why is it important?Web accessibility... Read More
Failure, just like success, is measured differently by each and... Read More
The following is a list of patterns that many visitors... Read More
A professional online reputation is essential to the flourishing of... Read More
Web Development |