views:

24

answers:

2

I'm trying to create a rewrite rule to match data-2, data-3, data-4 etc. and send them to data.php?var=2. It needs to ignore data-1.

RewriteRule ^data-([2-9])/?$ index.php?page=data&var=$1 [NC,L]

The above rule works for numbers 2-9, but how can I make it so that it works for any number greater than 1?

+3  A: 
RewriteRule ^data-([2-9]|[1-9]\d+)/?$ index.php?page=data&var=$1 [NC,L]
M42
Perfect, thanks
bcmcfc
+1  A: 

Try:

RewriteRule ^data-([2-9]|[1-9]\d+)/?$ index.php?page=data&var=$1 [NC,L]
cletus
Perfect, thanks (same answer at the same time must mean it's the best solution ;) )
bcmcfc