Rewrite /article.php?a=x to /article/x [mod_rewrite]

Discussion in 'Apache' started by peter_anderson, Feb 11, 2009.

  1. #1
    Hi,

    I am trying to rewrite article.php?a=x [any number, letter, symbol, word, etc would go there] to /article/x, but I suck at .htaccess.

    What is the best way to do this?

    Thanks ;)
     
    peter_anderson, Feb 11, 2009 IP
  2. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #2
    yoursite.com/.htaccess
    
    RewriteEngine on
    RewriteRule ^/article/(.*)$ article.php?a=$1 [L]
    
    Code (markup):
     
    thuankkk, Feb 11, 2009 IP
  3. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Thanks!

    Peter
     
    peter_anderson, Feb 12, 2009 IP