PHP Redirect
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.
MORE RESOURCES:
 |
 |
 |
RELATED ARTICLES
4 Rock Solid Reasons For Building Your Own Website
What is the point of having a website, you may ask, when the affiliate programme you have joined has provided you with your own web page to promote? This is a fair question. The answer has to be that with your own site - and of course your own domain name - you will have a lot more control over your business.
Functions and Subroutines in ASP
Functions and Subroutines in ASP
If you read our Tutorial on Include Files (SSI) then you learned how to encapsulate ASP code within include files and the benefits it brings us.
As developers, we should endeavour to make our lives easier wherever possible.
Why Do I Need A Web Site?
Even though the Internet has been around for a long time and many people are "educated" about the Internet, most have little knowledge about what a web site is and what can it do for their business.A web site is anything and everything you want it to be.
WYSIWYG Versus Coding: HTML With A Purpose
After years of working with entrepreneurs who developed their first web site using an image-based editor, the new world of internet marketing has placed a stronger emphasis on web development that conforms to technical concerns such as search engine optimization and multi-browser compatibility.Wigging OutWYSIWYG (What You See Is What You Get, pronounced "whizzy wig") web site editing programs can allow anyone to develop rich, full-feature web sites without a working knowledge of HTML (Hypertext Markup Language).
Learn What 98% of Targeted Visitors Do On Your Website
Getting a Targeted Visitor to a website is a waste of time and money if you've got no idea what 98% of them do when they get there.I'm assuming that if you have a website selling products that your conversion rate is at least 2%.
Ebooks for Webmasters
Internet has opened a whole new world for web developers and web designers who are looking to get their websites developed that are finally launched on the huge world of World Wide Web. Keeping that factor webmasters are the people who have to face a lot of problems mainly due to the entrance of new software, programming languages and viruses that are a real threat for the webmasters.
Building eCommerce Websites that Work - Part 3
An interesting eCommerce success factor that isn't precisely overlooked, but which is often thought about more in terms of being a way of feeding the search engine spiders has to do with providing content. In a very real sense the customer's job is to consume.
7 Reasons Why Your Small Business Needs A Web Site
Many small businesses have the misconception that their business can not benefit from a website; that websites are too expensive or that because they don't use a computer neither do their potential clients. Here are 7 reasons why your small business NEEDS a website:1.
Three Things Every Website Should Do
When I started my company in 2002, I knew I needed to have a website. Why? To provide credibility! How can a company be "real" in this day and age if it doesn't have a website? So, like many companies, I published an informational website that explained "here's who we are, and here's what we do".
Let Marketing Manage Your Website Content
The definition of the phrase "Content Management" depends on what the organization may need or a vendor may offer. There is no general purpose or standard content management system that can satisfy today's diverse business needs across the board.
Get to Know People through Websites
Web sites are not just places to sell things; they are a medium where people can get insight into other people's lives. Take the musician Xavier Rudd for example.
Why Every Small Business Owner Needs Two Websites
Every small business owner knows that they need a website, right? Well the truth is what they really need is at least two websites.One website that is specific to their business, product, service, name, etc.
What is Blogger.com?
In the late 1990's three San Francisco based web developers came up with the idea of being able to share information about anything on the web. The terminology they used was called blog.
Using Mini Websites - Powerful Way to Direct Marketing
Mini Websites are the most powerful and cost effective solution to promote and market your brand. Normally people go for a large site which have 100's of pages of selling nos.
The Power Is In The Pipes: How To Get Maximum Leverage From Your Website
What is the most important part of your online business?Many people would say: "my website". And that'sunderstandable - it's the most visible part of an internetbusiness.
Do This One Thing to Create a Powerful Product-Selling Web Site
Spend time planning your Web site. Before you design a page or write a word, get a visual, and mental picture of your preferred audience.
MySQL Database Handling in PHP
Most interactive websites nowadays require data to be presented dynamically and interactively based on input from the user. For example, a customer may need to log into a retail website to check his purchasing history.
How To Get Profits From Your 404 Page Not Found File
"'Page Not Found' on this Server. Check the URL and try again.
Direct Sales and Your Corporate Website - A Creative Marketing Plan that Works!
Creatively marketing your corporate site takes time in the set up but you will learn that building your customers isn't about marketing your products but getting your name and reputation into the minds of internet customers.I have randomly chosen Watkins to design a marketing approach but you will see how to apply this concept to any direct sales company.
Nonsense! Why Do I Need a Website?
"I don't sell anything online, I don't advertise online, in fact I don't really even know how to use a computer..
|