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.
residential cleaning services Lincolnshire ..Most people know they need a website in order to... Read More
When marketing your website, it's important to know which of... Read More
"I don't sell anything online, I don't advertise online, in... Read More
The first step in setting up an online business...Starting an... Read More
That's right. According to a recent study by Nielsen/NetRatings, Amazon.com... Read More
Your ObjectiveYour small business needs an appealing and professional website... Read More
"I have a small business with just a couple of... Read More
When a user signs up at your website, you may... Read More
#5 User Satisfaction: Learn what your visitors and site users... Read More
Web sites are not just places to sell things; they... Read More
Often time I've browsed sites and seen the same thing... Read More
Understanding and using web analytics.In recent years, website marketers were... Read More
People like to get immediate responses to requests. Autoresponders are... Read More
With the New Year upon us yet again, it's time... Read More
2 Golden Rules for an Engaging Website35% of visitors fail... Read More
You've put up a website to promote a product or... Read More
If you like the Internet and surfing through the billions... Read More
Just starting out, you can start with a simple informational... Read More
Simply ensuring your website is accessible to screen reader users... Read More
Did you know that hosting companies overcrowd their servers despite... Read More
While it may seem like a "quick and easy" task,... Read More
If you are living in a country that its native... Read More
Selecting the Perfect Domain NameThe first issue I have with... Read More
Visitors to your site come looking for information or solutions... Read More
The following is a list of patterns that many visitors... Read More
best cleaning company Highland Park ..Is your website Really useful?I had a 'rep' in yesterday... Read More
Building a website and getting it online is easy. Driving... Read More
If you don't have a web site yet, are thinking... Read More
Anyone who knows anything about web accessibility knows that images... Read More
I recently helped my mom to launch a website (www.mom2me.com)... Read More
1. As the first step, "Hire a web designer."First create... Read More
cPanel is a control panel for your website and allows... Read More
I recently received an unsolicited e-mail from some company offering... Read More
Many executives and investors are skeptical that software products can... Read More
With search engines putting a damper on direct reciprocal links,... Read More
The art of turning website visitors into paying customers depends... Read More
A company must earn and keep trust or sales don't... Read More
If you're anything like most small business owners, you probably... Read More
So you want to take a look at a real... Read More
Directory Generator, a product from Armand Morin and Marc Quarles,... Read More
Web templates by nature are created to aid and ease... Read More
Although there are significant differences among the various types of... Read More
Getting a Targeted Visitor to a website is a waste... Read More
The process of Web application development is critical to the... Read More
Internet has opened a whole new world for web developers... Read More
Every online entrepreneur I talk to is asking the same... Read More
Affiliate programs are a great way to earn an income... Read More
Selecting the Perfect Domain NameThe first issue I have with... Read More
First, an eye opener. Making your fortune through affiliate programs... Read More
Functions and Subroutines in ASP If you read... Read More
Web Development |