www.webdeveloper.com
Results 1 to 6 of 6

Thread: PDF Redirect

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Location
    San Jose CA & Land O Lakes, FL
    Posts
    3

    PDF Redirect

    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.

    Any ideas?

  2. #2
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    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.
    Best wishes,
    Eye for Video
    www.cidigitalmedia.com

  3. #3
    Join Date
    Dec 2011
    Location
    San Jose CA & Land O Lakes, FL
    Posts
    3
    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.

  4. #4
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    Nut Shell...

    URL rewriting.

    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...
    We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
    Code:
    Youre = {
          STILL_not_getting_it:function(){
               alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
          },
          MissingThePoint:function(msg){
                alert("You're missing the point. " + msg);
          }
    }
    Youre.STILL_not_getting_it();

  5. #5
    Join Date
    Dec 2011
    Location
    San Jose CA & Land O Lakes, FL
    Posts
    3

    URL rewriting

    OK, JunkMale, I've read
    http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
    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...

  6. #6
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    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.

    http://it.amid.com/2009/03/24/url-rewrite-examples/
    http://roshanbh.com.np/2008/03/url-r...-htaccess.html

    for example came from a simple search for "Url Rewriting Examples"
    We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
    Code:
    Youre = {
          STILL_not_getting_it:function(){
               alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
          },
          MissingThePoint:function(msg){
                alert("You're missing the point. " + msg);
          }
    }
    Youre.STILL_not_getting_it();

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles