relative links mod_rewrite

Discussion in 'Apache' started by Aluxton, Aug 5, 2009.

  1. #1
    Hi

    I have just started tinkering with mod_rewrite and am having difficulties with relative links. I understand that I can make all links absolute which takes away any problems but I would prefer not to do it this way. I have tried writing a rule that rewrites all files and sub-folders back to the root.

    I feel I am going around in circles, any help would be great!

    This is what I have so far. The top two lines work. I just need to add another that rewrites for example:
    /training/course/dermal/<anything> to /<anything>

    RewriteRule ^popup/([A-Z,a-z,0-9]+)/([A-Z,a-z,0-9]+)/$ pop-up.php?$1=$2
    RewriteRule ^training/([A-Z,a-z,0-9]+)/([A-Z,a-z,0-9,_,&]+)/$ training_auto.php?$1=$2
    Code (markup):
    Thanks Anthony
     
    Aluxton, Aug 5, 2009 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^/training/course/dermal/(.*)/?$ $1
    Code (markup):
    just sounds weird, though.
     
    szalinski, Aug 20, 2009 IP