Help with URl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • undbund

    #1

    Help with URl

    Hi, i have a pdf file located at the following location:
    http://www.somedomain.com/2006/members/news/somepdf.pdf

    I want to be able to access the same pdf from the same location but
    with the follwing url

    http://www.somedomain.com/2006/news/somepdf.pdf

    or

    http://www.somedomain.com/2006/news/view/somepdf.pdf

    where view is actually a php file view.php

    Notice that i have hidden the members directory!

    How can i achieve this, how can i (hide/add extra) certain sections of
    the url, to prevent the user from knowing the actual url from the
    address bar of the browser.

    Thanks
    undbund

  • Jerry Stuckle

    #2
    Re: Help with URl

    undbund wrote:
    Hi, i have a pdf file located at the following location:
    http://www.somedomain.com/2006/members/news/somepdf.pdf
    >
    I want to be able to access the same pdf from the same location but
    with the follwing url
    >
    http://www.somedomain.com/2006/news/somepdf.pdf
    >
    or
    >
    http://www.somedomain.com/2006/news/view/somepdf.pdf
    >
    where view is actually a php file view.php
    >
    Notice that i have hidden the members directory!
    >
    How can i achieve this, how can i (hide/add extra) certain sections of
    the url, to prevent the user from knowing the actual url from the
    address bar of the browser.
    >
    Thanks
    undbund
    >
    Not a PHP question.

    My first suggestion would be to create a logical link for the file.
    Other than that, check a newsgroup related to your OS and/nor
    alt.Apache.Conf iguration

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Chuck Anderson

      #3
      Re: Help with URl

      undbund wrote:
      Hi, i have a pdf file located at the following location:
      http://www.somedomain.com/2006/members/news/somepdf.pdf
      >
      I want to be able to access the same pdf from the same location but
      with the follwing url
      >
      http://www.somedomain.com/2006/news/somepdf.pdf
      >
      or
      >
      http://www.somedomain.com/2006/news/view/somepdf.pdf
      >
      where view is actually a php file view.php
      >
      Notice that i have hidden the members directory!
      >
      How can i achieve this, how can i (hide/add extra) certain sections of
      the url, to prevent the user from knowing the actual url from the
      address bar of the browser.
      >
      Thanks
      undbund
      >
      >
      For the second case, *and* if members is literally the name of the
      directory, serve the file from view.php like so:

      <?php

      $file = $_SERVER'[PATH_INFO']
      // in some cases it's ORIG_PATH_INFO - use phpinfo to take a look

      // set the correct path here
      $file = '/2006/members/news/' . $file;

      header('Content-Description: File Transfer');
      header('Content-Type: application/pdf');
      header('Content-Length: ' . filesize($file) );

      // to download
      header('Content-Disposition: attachment; filename=' . basename($file) );

      // to open in browser
      // header('Content-Disposition: inline; filename=' . basename($file) );

      readfile($file) ;
      ?>


      --
      *************** **************
      Chuck Anderson • Boulder, CO

      *************** **************

      Comment

      Working...