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.
Before you start building your site, ask yourself "WHY?". Why... Read More
I talk with so many people who have small businesses... Read More
"If you build it, they will come"; is an age... Read More
After planning the design and content of your website, it's... Read More
If you've been developing websites on Mars for the past... Read More
Part of the success of most home-based businesses is their... Read More
Fantastico is a 3rd-party cPanel add-on and can be purchased... Read More
Making a web site is easy. Making a good web... Read More
What do you mean, you don't have a website for... Read More
Simply ensuring your website is accessible to screen reader users... Read More
Webmasters deal with a myriad of complex design challenges every... Read More
The first step in setting up an online business...Starting an... Read More
Do you make your website just to entertain yourself or... Read More
2 Golden Rules for an Engaging Website35% of visitors fail... Read More
Running an effective website is a continuous process. I have... Read More
When you publish a content site there are times when... Read More
A while ago one of my clients approached me and... Read More
As increasing numbers of people search for information on the... Read More
--------------------------------Why Should You Create a website?--------------------------------A. What do you want... Read More
URL rewriting are major needs for your sites that produce... Read More
So your prospect, Mary, is sitting at the computer reading... Read More
You hear a great deal about the Internet these days... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
Visitors to your site come looking for information or solutions... Read More
Absolutely everything stems from the purpose of your website -... Read More
You want to give your site's visitors a way to... Read More
If one more business owner tells me their website sucks... Read More
Your web site will be your window to the world.... Read More
A common dilemma most small and medium businesses face when... Read More
A website lets you put your products in front of... Read More
One of the biggest mistakes that most online retailers make... Read More
If you don't have a web site yet, are thinking... Read More
When used to describe a web site, the term "sticky"... Read More
The process of Web application development is critical to the... Read More
The following is a list of patterns that many visitors... Read More
The popular search engine Google indexes over 8 billion websites.... Read More
As increasing numbers of people search for information on the... Read More
The needs of screen magnifier users are overlooked when implementing... Read More
What to put your the website if you are an... Read More
So you want to take a look at a real... Read More
Designing and creating your own website does not have to... Read More
Optimize your time. How much time each day must you... Read More
Can you imagine the hypocrisy of spending thousands of dollars,... Read More
So what do you do if need to get a... Read More
Does My Web Site Require A Web Database?If your web... Read More
Designing an E-commerce Web site is not as simple as... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
Many millions of dollars are being wasted on promoting and... Read More
With more and more countries around the world passing laws... Read More
Three way linking and concerns.For many years SEO experts were... Read More
Web Development |