Remove info from end of URL using mod_rewrite

Discussion in 'Apache' started by wedgin, Mar 13, 2008.

  1. #1
    This is probably dead simple, but I can't seem to find an article that addresses exactly what I need done. I already have an existing htaccess page with mod_rewrite rules applied working on my server.

    I need an htaccess rule to turn this URL
    http://www.sitename.com/archive/2008/02/29/Article_Name_Here/main_feed
    into this URL
    http://www.sitename.com/archive/2008/02/29/Article_Name_Here

    This will need to be a general rule to convert all incoming URLs that have this main_feed bit attached to it, not just a single instance.

    Any help would be greatly appreciated. Thanks
     
    wedgin, Mar 13, 2008 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    RewriteRule ^(.+)/main_feed$ $1 [QSA,L,NC]
    Code (markup):
     
    joebert, Mar 13, 2008 IP
  3. wedgin

    wedgin Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I just gave that a shot and it didn't seem to do anything. Is there something else I should be doing to make it work?
     
    wedgin, Mar 14, 2008 IP
  4. Isaak

    Isaak Guest

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This would be better:
    Tell me if it works as wanted.
     
    Isaak, Mar 14, 2008 IP
  5. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #5
    Explicitly turning RewriteEngine On like Isaak added will probably do it.
     
    joebert, Mar 14, 2008 IP