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.
family-safe home cleaners Northbrook ..How can we add Word Rich Content to our Websites... Read More
You've put up a website to promote a product or... Read More
You've decided to create a website to market your products... Read More
In my previous life.....Actually, my previous JOB life, I was... Read More
So your traffic is going through the roof yeah? It's... Read More
Webmasters deal with a myriad of complex design challenges every... Read More
A company must earn and keep trust or sales don't... Read More
An Introduction to Server Side IncludesBeginner? That's OK!While much has... Read More
When we review the sites of potential clients, there are... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
1. Splash pagesMost of the time splash pages are uncalled... Read More
Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More
If you're fairly new to the Internet scene, you may... Read More
A lot of people these days are interested in getting... Read More
So you've decided to start an online work at home... Read More
This simple question can take on several different forms, but... Read More
The following is a list of patterns that many visitors... Read More
Anyone who knows anything about web accessibility knows that images... Read More
This article was prompted by some customer support work I... Read More
The "robots" meta tag, when used properly, will tell the... Read More
If you're an up and coming graphic/web designer just out... Read More
No matter the size of your business, having a web... Read More
"I am a writer, not a business-person. I don't want... Read More
When you started reading this sentence you assumed lo acabar?a... Read More
A lot has changed in the way sites are optimized... Read More
residential cleaning services Deerfield ..RIVERSIDE, CA August 4, 2004 ?- "Historically, small business owners... Read More
Although there are significant differences among the various types of... Read More
I am just a learner who likes to delve in... Read More
You have permission to publish this article electronically, in print,... Read More
Visitors to your site come looking for information or solutions... Read More
What is web accessibility & why is it important?Web accessibility... Read More
"I don't sell anything online, I don't advertise online, in... Read More
There's been widespread speculation about the new legislation being introduced... Read More
An additional benefit of website accessibility is an improved performance... Read More
The DDA (Disability Discrimination Act) states that service providers must... Read More
We all start out the same. Some have budgets, some... Read More
I'm one of those people that always wanted a website,... Read More
Internet Marketing is not a miracle marketing strategy ? competition... Read More
Let's begin by setting some limits. If you're like me,... Read More
Functions and Subroutines in ASP If you read... Read More
The needs of screen magnifier users are overlooked when implementing... Read More
"What's in it for me?" you ask. "Why should I... Read More
Never has competition been so difficult in the Internet world.... Read More
Creating a content management system either from scratch,... Read More
If you're looking for better web site ROI, chances are,... Read More
Design and layout can make your communication come alive and... Read More
This is a growing concern amongst many business owners. Does... Read More
--------------------------------Why Should You Create a website?--------------------------------A. What do you want... Read More
A lot has changed in the way sites are optimized... Read More
The popular search engine Google indexes over 8 billion websites.... Read More
Web Development |