.htaccess URL re-writing problem (almost there)

Discussion in 'Apache' started by rakers8, Oct 2, 2009.

  1. #1
    I think this is the appropriate forum. I'm on a Windows IIS server but I'm using ISAPI Rewrite that supposedly emulates Apaches 'mod-rewrite'

    So,
    After much trial and error I have achieved, what I think, are appropriate URL rewrites.

    Notice this URL:
    http://www.rentittoday.com/charter-jets-and-helicopters/Charter-Jet-Rentals-Stratos-Challenger-604-9?Charter-Jet-Rentals-Stratos-Challenger-604-9

    And notice how it repeats the listing twice.
    ?Charter-Jet-Rentals-Stratos-Challenger-604-9

    However the appropriate URL that I'm trying to achieve in the end still works.

    http://www.rentittoday.com/charter-jets-and-helicopters/Charter-Jet-Rentals-Stratos-Challenger-604-9

    The links clicked to get to the above details page are listed in our search results page:
    http://www.rentittoday.com/viewers/air_plane_charter_jets_results.php

    I'm trying to figure out if it's appending the listing twice because of our htaccess code or something within CMS (such as viewer url, filename fields, or some other code)

    The htaccess code for the above string is:

    RewriteBase / 
    RewriteCond %{QUERY_STRING} (.*) 
     
    RewriteRule ^viewers/air_plane_charter_jets_details\.php$ /charter-jets-and-helicopters/%1 [NC,R=301] 
     
    RewriteRule ^charter-jets-and-helicopters/([^/.]+)/?$ /viewers/air_plane_charter_jets_details.php?$1 [NC,L]
    Code (markup):
    Appreciate any help with this matter.
     
    rakers8, Oct 2, 2009 IP
  2. chadsmith

    chadsmith Peon

    Messages:
    82
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It needs a ? at the end of

    RewriteRule ^viewers/air_plane_charter_jets_details\.php$ /charter-jets-and-helicopters/%1? [NC,R=301] 
    Code (markup):
    To tell it not to append the query string.
     
    chadsmith, Oct 2, 2009 IP
  3. rakers8

    rakers8 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a bunch, that got it.
     
    rakers8, Oct 2, 2009 IP