Mod rewrite help thanks

Discussion in 'PHP' started by ads2help, Dec 5, 2008.

  1. #1
    How to construct the mod_rewrite file if I want

    http://mysite.com/mydir/4357hhdbgd5td7fd77fdghdsfdg0

    to

    http://mysite.com/myfunction.php?what=4357hhdbgd5td7fd77fdghdsfdg0


    The red part is a random string that consists of lower case alphabets and numbers only.

    Thanks!!
     
    ads2help, Dec 5, 2008 IP
  2. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On
    RewriteRule ^mydir/(.*) /myfunction.php?what=$1

    that's what I use ?
     
    juust, Dec 5, 2008 IP
  3. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #3
    A little bit modification based from juust's previous post.

    
    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^mydir/(.*)$ myfunction.php?what=$1 [NC,L]
    
    Code (markup):
     
    xrvel, Dec 6, 2008 IP