Lets first learn about some redirects and then we'll see how to implement them on different servers and/or environment.
- Redirection : In the HTTP protocol used by the World Wide Web, a redirect is a response with a status code beginning with 3 that induces a browser to go to another location. The HTTP standard defines several status codes for redirection:
- 300 multiple choices (e.g. offer different languages)
- 301 moved permanently
- 302 found (e.g. temporary redirect)
- 303 see other (e.g. for results of cgi-scripts)
- 307 temporary redirect
- Dealing the redirection :
- html:
HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/
Content-Type: text/html
Content-Length: 174
<html>
<head>
<title>Moved</title>
</head>
<body>
<h1>Moved</h1>
<p>This page has moved to <a href="http://www.example.org/">http://www.example.org/</a>.</p>
</body>
</html>- CF : Put the following code on the Application.cfm/cfc or on the home page
<cfheader statuscode="301" statustext="Moved Permanently" />
<cfheader name="location" value="http://www.new-url.com"; />
<cfabort />- Apache server : Put the following lines on the .htaccess file
Redirect ^oldpage.html http://www.example.com/newpage.html [R=301,L]
- php
No comments:
Post a Comment