Problem with mod_rewrite

Discussion in 'Apache' started by yevlesh, Jun 2, 2007.

  1. #1
    I have a URL along the line of
    http://domain.com/folder/?type={ifsearch:GoogleAdWordsSearch}{ifcontent:GoogleAdWordsContent}&src=gadw&campaign=CAMPAIGNNAME&keyword=MY%20KEYWORD&art=MY_KEYWORD&artist=MY+KEYWORD&song=ANOTHER+WORD


    I am trying to rewrite this to something like http://domain.com/CAMPAIGNNAME/MY_KEYWORD/ANOTHER_WORD

    what mod_rewrite rules should I use to accomplish something like this?

    I've read and re-read the FAQ at http://forums.digitalpoint.com/showthread.php?t=23044 , but haven't been able to get the URL to work so far.
     
    yevlesh, Jun 2, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Post an original URL example, instead of all this if stuff. If a lot of that stuff has to be in the URL, you'll have a much longer URL than domain.com/CAMPAIGNNAME/MY_KEYWORD/ANOTHER_WORD
     
    Nintendo, Jun 2, 2007 IP
  3. yevlesh

    yevlesh Active Member

    Messages:
    162
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Here is an actual URL example:

    http://www.mydomain.com/music/?type={ifsearch:GoogleAdWordsSearch}{ifcontent:GoogleAdWordsContent}&src=gadw&campaign=Music5&keyword=Kool%20And%20The%20Gang%20song&art=Kool_And_The_Gang&artist=Kool+And+The+Gang


    The goal is to make that URL look static, while still remaining keyword rich.
     
    yevlesh, Jun 3, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    Seems too simple but is this what you want (if not, then hopefully you can work from it)):
    RewriteRule ([^/]+)/([^/]+)/([^/]+) /music/?type=GoogleAdWordsSearch&src=gadw&campaign=$1&keyword=$2&art=$3&artist=$3
    Code (markup):
    That will change:
    _http://www.mydomain.com/Music5/Kool And The Gang song/Kool_And_The_Gang
    To:
    _http://www.mydomain.com/music/?type=GoogleAdWordsSearch&src=gadw&campaign=Music5&keyword=Kool And The Gang song&art=Kool_And_The_Gang&artist=Kool_And_The_Gang

    You might want to add an extra parameter to the new URLs for GoogleAdWordsSearch/Content
     
    krt, Jun 3, 2007 IP