Rewrite Rules

Discussion in 'Apache' started by EnDLeSs_27, Jan 14, 2009.

  1. #1
    If I have a lot of URLs that are similar to this

    RewriteRule ^information/anime-index index.php?sub=information&mod=$1&newsid=anime,index&note=$3 [L]
    RewriteRule ^information/tv-tokyo index.php?sub=information&mod=$1&newsid=tv,tokyo,information&note=$3 [L]
    Code (markup):
    RewriteRule ^multimedia/avatars index.php?sub=multimedia&mod=avatars&fileid=$2&note=$3&type=$4 [L]
    RewriteRule ^multimedia/wallpapers index.php?sub=multimedia&mod=wallpapers&fileid=$2&note=$3&type=$4 [L]
    Code (markup):
    How would I rewrite them using one or two rewrite rules rather then just putting every url into the .htaccess one by one.
     
    EnDLeSs_27, Jan 14, 2009 IP
  2. ConquestYoutube

    ConquestYoutube Peon

    Messages:
    138
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^multimedia/([^/\.]+)/?$ index.php?sub=multimedia&mod=$1 [L]
     
    ConquestYoutube, Jan 14, 2009 IP
  3. EnDLeSs_27

    EnDLeSs_27 Active Member

    Messages:
    112
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    That works for the second part. But what about if the URLS are like

    RewriteRule ^information/anime-index index.php?sub=information&mod=$1&newsid=anime,index&note=$3 [L]
    RewriteRule ^information/tv-tokyo-information index.php?sub=information&mod=$1&newsid=tv,tokyo,information&note=$3 [L]
    Code (markup):
     
    EnDLeSs_27, Jan 14, 2009 IP