Mod_rewrite Tips

Discussion in 'Programming' started by itnashvilleCOM, Jun 25, 2008.

  1. #1
    A few people have PMed me for mod_rewrite help, so I thought I would share the answers to what they asked.

    That is simple. Put this in there:

    
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
    
    Code (markup):

    That too, not hard if you use this for example as a guide:

    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/([^/]+)/?$ /directory.php?category=$1&subcat=$2 [L,QSA]
    
    Code (markup):
    I hope this helps a few of you :)
     
    itnashvilleCOM, Jun 25, 2008 IP
  2. DeeJayEl

    DeeJayEl Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Good stuff. Keep it coming.
     
    DeeJayEl, Jun 25, 2008 IP
  3. bugasoft

    bugasoft Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Nice info, i will try it.
     
    bugasoft, Jun 25, 2008 IP