tags:

views:

6

answers:

1

I have url's like games/xbox/2 2 being the page number. some url's are as follows games/xbox-360/2 i need the links to be rewritten. here is the code i am using which works fine for the links with no - in them

RewriteRule games/([A-Za-z0-9]+)/?$ games/consoles.php?console=$1 
RewriteRule games/([A-Za-z0-9]+)/([0-9]+)/?$ games/consoles.php?console=$1&page=$2 

what needs to be added to the reg expression to make it also rewrite the links that have the - in them. Thanks

A: 

If you add the - right before the ] it will work. But a better method is to escape the - with a \ so you'll end up with [A-Za-z0-9\-]

WoLpH