Thread: Mod_rewrite
View Single Post
Old 10-25-2007, 04:53 PM   #8 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

There's still a problem with that Regex string, the first grouping (first set of parentheses) will match everything:
www.mysite.com/articles/14/article_name would lead to:
$_GET['id'] = "14/article_name"
It's just simple regular expressions and a more appropriate one would be somewhere along the lines of:
Code:
RewriteRule ^articles/([0-9]+)/([^/]+)/?$ view.php?action=view&id=$1&article=$2 [QSA,L]
If you need things explaining, just ask. :)
Salathe is offline  
Reply With Quote