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.
spotless home service Morton Grove ...If you're anything like most small business owners, you probably... Read More
A simple website stats counter is not enough if you... Read More
It is an undeniable fact that not everybody is keen... Read More
"If you build it, they will come"; is an age... Read More
When you consider the billions of individuals and companies on... Read More
While studying online for IT investment opportunities, I found that... Read More
When visitors add your web site to their Favorites or... Read More
You know exactly what your organisation does and what your... Read More
Here's something you may never have thought of before:If I... Read More
Many millions of dollars are being wasted on promoting and... Read More
A website is lifeline of internet home business. In order... Read More
SiteSpinnerSiteSpinner is a user-friendly web site development tool that includes... Read More
Affiliate programs are a great way to earn an income... Read More
I talk with so many people who have small businesses... Read More
First, using a lot of web graphics, flash, banners and... Read More
One of my most salient memories from when I sold... Read More
I'm one of those people that always wanted a website,... Read More
There have been many significant changes to the face of... Read More
With the New Year upon us yet again, it's time... Read More
Does My Web Site Require A Web Database?If your web... Read More
#5 User Satisfaction: Learn what your visitors and site users... Read More
Server Side Includes (SSI) with ASP People often... Read More
Rosalind wants to share her inspirational poetry with a wider... Read More
Most interactive websites nowadays would require a user to log... Read More
"I am a writer, not a business-person. I don't want... Read More
one time home cleaning Park Ridge ...As a business you can't afford to ignore the Internet... Read More
The big thing these days is your ability to capture... Read More
"'Page Not Found' on this Server. Check the URL and... Read More
Writing for the web is totally different to writing for... Read More
As increasing numbers of people search for information on the... Read More
While it may seem like a "quick and easy" task,... Read More
Many of site owners still don't realize all advantages of... Read More
Knowledge is power.And undoubtedly, it is the key to making... Read More
Web templates by nature are created to aid and ease... Read More
Why do some web sites reap huge benefits while others... Read More
Even with the steady growth of the World Wide Web,... Read More
What is the most important part of your online business?Many... Read More
Never has competition been so difficult in the Internet world.... Read More
A while ago one of my clients approached me and... Read More
Profiles are one of the best kept secrets around regarding... Read More
Thinking about starting up a business? The web is the... Read More
When you publish a content site there are times when... Read More
A website provides invaluable advantages for businesses who have one.7... Read More
You've put up a website to promote a product or... Read More
So you have a good idea for a business and... Read More
Building a new website can be a lengthy task. From... Read More
--------------------------------Why Should You Create a website?--------------------------------A. What do you want... Read More
Affiliate programs are a great way to earn an income... Read More
See how you can create graphic effects on text with... Read More
A company must earn and keep trust or sales don't... Read More
Web Development |