#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Complex htaccess rules


    Hi all,

    I've just taken control of a site (written by another developer), which has a load of unfriendly URLs that the client would like me to make 'friendly'.
    I've done this using .htaccess and mod-rewrite.

    I need to re-write URLs such as the following, but don't know how to write the rules to do so.
    An example of the type of URL I have to convert is as follows:

    /09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1

    Needs to become:

    /frames/aluminium/1

    'search_KEYWORD' can have a load of string values including aluminium, black, silver, steel, etc.
    'search_RANGE' can be Frames, Posters, Photos... and lots of other things
    'o' is always a numerical value, and is used to indicate which page the user is currently on.
    'search' is also numerical.

    I thought I'd need to do something like this in .htaccess:
    Redirect 301 09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1 /frames/aluminium/$1

    However I can't make this work at all. Can anyone please help?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,959
    Rep Power
    9397

IMN logo majestic logo threadwatch logo seochat tools logo