1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Htaccess rewrite

Discussion in 'Apache' started by mingis, Sep 12, 2013.

  1. #1
    I'm trying to rewrite the following URL but can't get it to work (I've read all the htaccess basics at apache.org).

    http://www.example.com/util/doc.jsp?n=document-num_137298138853890.pdf

    I'd be most grateful if anyone with more experience could point out where I'm going wrong. My htaccess code is:

    
    RewriteBase /
    
    RewriteCond %{QUERY_STRING} ^n=document-num_137298138853890\.pdf$
    RewriteRule ^util/doc.jsp$ http://www.example.com [R=permanent,L]
    
    Code (markup):
     
    mingis, Sep 12, 2013 IP
  2. JackVipor

    JackVipor Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #2
    Try this

    RewriteCond %{QUERY_STRING} ^n=document-num_137298138853890\.pdf$
    RewriteRule ^util/doc.jsp$ / [R=permanent,L]
    Code (markup):
     
    JackVipor, Sep 13, 2013 IP
  3. BreezeHost

    BreezeHost Member

    Messages:
    139
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    28
    #3
    Try below syntax :
    Redirect old file path to new file path
    Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
     
    BreezeHost, Oct 3, 2013 IP