apache2: rewrite rules to use absolute URLs on test server

Discussion in 'Server Operation' started by friendly, Apr 26, 2010.

  1. friendly

    friendly New Member

    I have a large set of web files on a server, with the file structure

    http://datavis.ca/
    books/
    courses/
    gallery/
    papers/
    ...

    On my development/test server, these are stored under

    ~friendly/datavis.ca/
    books/
    courses/
    gallery/
    papers/
    ...
    and I view them as http://my.test.server/datavis/

    but that path is *not* the DocumentRoot on that server. Thus, in an HTML file
    within the datavis.ca tree, if I write

    <a href="/papers/asa92.html"> ...
    that will work OK on the web server, but not on my test server.

    How can I write a set of rewrite rules for the apache2 rewrite module on
    the test server to say
    "within the datavis.ca tree, interpret /papers, etc. to refer to /datavis/papers, etc."?

    I've read the documentation at
    http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
    but I don't see how to accomplish what I want.

    TIA for any help on this
     
  2. falko

    falko Super Moderator Howtoforge Staff

Share This Page