why doesn't this mod_rewrite work?

November 3, 2013 1.8k views
Hello, I am facing an issue which I can't resolve. this is my .htaccess file
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w\d~%.:_\-]+)$ index.php?page=$1 [QSA]
RewriteRule ^news/([0-9]+) /news?id=$1
RewriteRule ^contact/([0-9]+) /contact?do=$1
RewriteRule ^account/([0-9]+) /account?action=$1
RewriteRule ^admin/([0-9]+) /admin?action=$1
Everything works beside the admin and account rules when I go the one if the working once, Then I get to the requested page i.e www.domain.com/page or www.domain.com/news/3 All working rules are ending in numbers, like the news rules, But admin and account rule doesn't end in a number, but in a string, like www.domain.com/account/settings which doesn't work. Anyone able to help me?
1 Answer
nwm I got it working :)

Solution for others:
([0-9]+) only matches numbers. If you want to match Strings, use either (.+) to match every character or some other character group ([a-zA-Z]+ for example).
Have another answer? Share your knowledge.