mod_rewrite question

Discussion in 'Apache' started by pc_user, Dec 31, 2006.

  1. #1
    You can do this

    RewriteRule ^(.*) index.php?file=$1
    ErrorDocument 404 notfound.php

    but

    how do you redirect a missing file, i.e. 404 with the file name to another location?

    For example

    on 404 redirect to site.com/file?file=$1

    Any ideas?

    Some say it can be done, others say it can't.
     
    pc_user, Dec 31, 2006 IP
  2. blfast

    blfast Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check the environment vars REDIRECT_URL and REDIRECT_QUERY_STRING
     
    blfast, Jan 26, 2007 IP