1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with mod_rewrite

Discussion in 'General Programming Chat' started by scheda, Sep 28, 2011.

  1. scheda

    scheda Regular Member

    Joined:
    May 4, 2010
    Messages:
    228
    Likes Received:
    61
    Hey guys,

    I've got a stupidly simple rewrite that I'm having trouble with.

    Basically I just want one URL to resolve as another.

    So, if a user visits /libs/file.html I want it to load /libs/loader.php

    Here's what I have now - that does not work...

    Code:
    # Enable Rewrite Engine
    RewriteEngine on
    
    #Create friendly URL
    RewriteRule ^/libs/file\.html$ /libs/loader\.php [L]
    Any idea on how to make this work properly?
     
  2. LukesDad

    LukesDad Junior Member

    Joined:
    Oct 24, 2009
    Messages:
    135
    Likes Received:
    71
    Location:
    Düsseldorf
    Home Page:
    Try

    Code:
    # Enable Rewrite Engine
    RewriteEngine on
    
    #Create friendly URL
    RewriteRule ^/libs/file\.html$ /libs/[B]loader.php[/B] [L]
     
  3. scheda

    scheda Regular Member

    Joined:
    May 4, 2010
    Messages:
    228
    Likes Received:
    61
    Nope, no go unfortunately. I just get a 404 error. Thanks though.
     
  4. scheda

    scheda Regular Member

    Joined:
    May 4, 2010
    Messages:
    228
    Likes Received:
    61
    Actually, I was able to figure out a better way to handle what I needed done.

    Thanks for your help.
     
  5. scriptomania

    scriptomania Junior Member

    Joined:
    Dec 28, 2010
    Messages:
    127
    Likes Received:
    249
    Occupation:
    A full time pirate at sea
    Location:
    The European capital of politics
    And how did you do that if you dont mind me asking?
    There might be other people running into the same problem... Can't just leave them hanging like that.