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.
![]() |
|
![]() |
|
![]() |
|
![]() |
Web templates by nature are created to aid and ease... Read More
As increasing numbers of people search for information on the... Read More
So you finally decided to invest in a web presence... Read More
Web accessibility has so many benefits that I really do... Read More
So what do you do if need to get a... Read More
How do you decide on the content, products and or... Read More
1) A marketing necessityI still hear it said from time... Read More
Creating and maintaining an effective presence on the Web has... Read More
When used to describe a web site, the term "sticky"... Read More
The Internet car buyer is an elusive animal. Trying to... Read More
Can you imagine the hypocrisy of spending thousands of dollars,... Read More
The evolution of web development parallels the model of technology... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
The internet has taken over our lives with a vengeance,... Read More
I recently received an unsolicited e-mail from some company offering... Read More
Your business website is a critical aspect of being able... Read More
What is web accessibility & why is it important?Web accessibility... Read More
Q1.Why would I need a web site? A1.- Improve my... Read More
"I don't sell anything online, I don't advertise online, in... Read More
If you are like me you have wanted to build... Read More
Research reveals three important facts:1) The Internet is one of... Read More
When you take a look at the most visited sites... Read More
Many small companies choose not to invest in a professionally... Read More
Are bloated images slowing down your web site and causing... Read More
Making money with your web site is the dream and... Read More
"How do I improve web site sales figures?" The CEO... Read More
Designing and creating your own website does not have to... Read More
Just starting out, you can start with a simple informational... Read More
Go to any internet marketing forum you want these days... Read More
The needs of screen magnifier users are overlooked when implementing... Read More
More and more businesses are recognizing the importance of content... Read More
Optimal website design is the art of logical navigation.It will... Read More
Q. Hey, Cathy: I'm just setting up a website. What... Read More
Web templates by nature are created to aid and ease... Read More
There are lots of HTML editors on the market, however,... Read More
The definition of the phrase "Content Management" depends on what... Read More
The Internet is being used by local service business to... Read More
Before you set up any scripts you will need some... Read More
As increasing numbers of people search for information on the... Read More
"'Page Not Found' on this Server. Check the URL and... Read More
First, using a lot of web graphics, flash, banners and... Read More
Although designing a great web site is an important part... Read More
If you've been developing websites on Mars for the past... Read More
Building a new website can be a lengthy task. From... Read More
A system development process can follow a number of standard... Read More
What happened on your website yesterday? What about last week... Read More
Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More
You've decided to create a website to market your products... Read More
What is CSS?CSS is a simple file which controls the... Read More
I'm one of those people that always wanted a website,... Read More
Every online entrepreneur I talk to is asking the same... Read More
Although CSS layouts have been around for years, they haven't... Read More
There are many different traffic analysis tools, ranging from simple... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
You've just finished congratulating your marketing team. After six months... Read More
1. Choose a big enough font size. A size 12... Read More
Like any area of business your website needs some effort... Read More
A professional online reputation is essential to the flourishing of... Read More
That's right. Your method, behavior and strategy you are now... Read More
While it may seem like a "quick and easy" task,... Read More
When you take a look at the most visited sites... Read More
They might not be wearing a mask and carrying a... Read More
Designing an E-commerce Web site is not as simple as... Read More
You know exactly what your organisation does and what your... Read More
Before you start building your site, ask yourself "WHY?". Why... Read More
Go to any internet marketing forum you want these days... Read More
Web Development |