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.
bathroom cleaning service Northbrook ..Yahoo has long offered email, an online calendar, notes, bookmarks,... Read More
An additional benefit of website accessibility is an improved performance... Read More
Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More
Your site is fast and getting traffic, but conversion rates... Read More
For years now I've been looking to start my own... Read More
#5 User Satisfaction: Learn what your visitors and site users... Read More
When I set up my website I felt paypal was... Read More
No matter the size of your business, having a web... Read More
One of the things that Internet excels is disseminating information... Read More
When you publish a content site there are times when... Read More
You don't believe in astrology but you check your horoscope... Read More
I'm one of those people that always wanted a website,... Read More
There are several reverse bid freelance sites out there. Beyond... Read More
Project Safekids provides webmasters a valuable tool which could save... Read More
It is an undeniable fact that not everybody is keen... Read More
It may seem like the publishing industry's equivalent of Beanie... Read More
A PHP Redirect automatically transfers a web user from one... Read More
In my previous life.....Actually, my previous JOB life, I was... Read More
Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More
Succeeding with an eCommerce website is a dream for many... Read More
1) Data CaptureOne easy way to collect e-mail addresses and... Read More
Anyone who knows anything about web accessibility knows that images... Read More
Optimal website design is the art of logical navigation.It will... Read More
An Introduction to Server Side IncludesBeginner? That's OK!While much has... Read More
Failure, just like success, is measured differently by each and... Read More
insured cleaning company Wilmette .."If you build it, they will come"; is an age... Read More
It amazes me how many people try to build serious... Read More
Thinking about starting up a business? The web is the... Read More
Losing website sales and traffic is sometimes simply a case... Read More
When I set up my website I felt paypal was... Read More
How can we add Word Rich Content to our Websites... Read More
While creating a Web site may seem like... Read More
1. Upload robots.txt file in to your root directory and... Read More
Webmasters deal with a myriad of complex design challenges every... Read More
Absolutely everything stems from the purpose of your website -... Read More
An accessible Web site is easily approached, easily understood, and... Read More
Setting up a website is the very first step of... Read More
After having decided to start a business, the next thing... Read More
Your site is getting traffic, but conversion rates are horrible.... Read More
I am just a learner who likes to delve in... Read More
Most people know they need a website in order to... Read More
"What's in it for me?" you ask. "Why should I... Read More
1. Splash pagesMost of the time splash pages are uncalled... Read More
Huge Mistake #1: Creating a Website with Flash -- Did... Read More
Every small business owner knows that they need a website,... Read More
If one more business owner tells me their website sucks... Read More
This simple question can take on several different forms, but... Read More
Although designing a great web site is an important part... Read More
Before you set up any scripts you will need some... Read More
Often time I've browsed sites and seen the same thing... Read More
Web Development |