After I posted a file to a web server, I announced the wrong URL, with a typo in the filename. I cannot update the announcement as it was e-mailed to a large list. So I would like to post a short file at the bad URL with a redirect to the good URL.
When I make that kind of error with an HTML file, it's easy to post a short HTML file at the bad URL, whose header contains a line like this:
<meta http-equiv="REFRESH" content="0;URL=http://domain.net/good_file.html">
Then a visitor's browser handles the redirect, and if he bookmarks the page he's viewing, he records its corrected URL.
But this time, the bad URL ends in extension .pdf so the server sends any file under that name with content-type: application/pdf which causes my browser to pass it directly to my PDF reader, which complains "File does not begin with '%PDF='".
My question is, what can I post in place of a PDF file which is not there, to have the same effect?
I do not have access to or authority to change the server's configuration files.
If the problem is a typo in the filename, why not just change the filename to exactly match the typo? Do this to a COPY of the original, keeping the original for other links that don't have the typo.
So you'll have two files, one with correct filename, one with the typo.
Eye for Video
Yes, my temporary fix is to store a duplicate copy of the file under the erroneous file name. However, this makes for two issues: (1) maintenance, each time the correct file is updated the extra copy will also need to be updated, and (2) clients who bookmark the file will record the bad rather then the corrected file name. Installing a redirect at the erroneous name, rather than a duplicate of the good file, would solve both issues.
Take a look at how to write a URL rewrite to rewrite the typo error URL to be dumped at the correct URL.
Then next time before you upload, double check the filename...
OK, JunkMale, I've read
and I still don't see how to get references to badfile.pdf to redirect to goodfile.pdf without modifying the server configuration files, which I don't have authority to modify. Can I do it in an .htaccess file? If so, could you show me an example of the syntax? Thanks...
No I don't but I am suggesting that you use it because thats its main purpose, rewriting URLs.
.htaccess has nothing to do with server config files, all you need to know is if it has been enabled. If it has then your can upload to a folder the .htaccess file that you write on your local machine.
When someone requests a URL with that folder in it, the rules made in that file are acted upon.
As for examples, the Internet is littered with them as is this site.
for example came from a simple search for "Url Rewriting Examples"
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread