When you are browsing, you may have noticed a that sometimes the browser serves you a URL (Uniform Resource Locator) different from the one you requested. Here is what happened. You asked for a certain URL, but the server noticed it listed in its tables as redirected or renamed. The server sends back the name of the replacement URL and a 301 response code, meaning the URL has changed/moved permanently. In theory, the browser is supposed to make a note of the new URL for future reference. The browser then makes a new request for the revised URL.
Sometimes this process can take several iterations before you finally get at the page you wanted. It is a bit of an idiotic way to do things. The server should just send you want you want on the first try. I think the idea is they want to punish you with needless delay for not making note of the new URL for future reference.
Sometimes, the server redirects you to a totally different website. Sometimes it gives a 302 response code, meaning the redirection is only temporary and you should continue to use the original URL in future. There are other response codes in the 300 to 399 range for other rarer types of redirection.
When you notice a redirection, you can update your bookmarks so you go directly in future. The trouble is, the browser will not tell you if a redirect is permanent or temporary. A temporary redirect will likely not work at all in future. Generally temporary URLs (Uniform Resource Locators) are long and full of gibberish.
If you are maintaining a website, you discontinue, rename, reorganize and move pages around. To be kind to you visitors, you want to arrange things so when they use the old names, they are taken to the new documents.
There are two ways to do this.
You must specify the new URL in full even if it is within the same site. # starts a comment. This information goes in configuration files: either .htaccess for per directory control, or httpd.conf, at the root of the Apache installation.
<!-- macro Moved bgloss/bgloss.html -->
This technique only works for *.html files. You cannot use it to redirect *.xml PAD (Portable Application Description) files, for example.
Ideally links on your site should be aware of any redirects. You should update your links. However, browsers don’t tell you about them. Other sites don’t inform you about them. It is up to you to test your links each day and replace links with the corresponding redirections. Very few websites bother to do this. The result is their links gradually get more and more out of date. Eventually they stop working altogether. Other than hiring a third world village to test your links each day, what can you do?
I wrote a free program called BrokenLinks to handle this. In addition to monitoring redirects, it monitors broken links. If they stay broken for 5 days or so (configurable), it warns me about them. I then have to fix the problem manually.
By daily staying on top of redirections and broken links, visitors to my site discover that:
This page is posted |
http://mindprod.com/jgloss/httpredirection.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\httpredirection.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.149.235.171] |
| |
Feedback |
You are visitor number | |