I have this rewrite rule that checks for a country code in the url and fetches content accordingly.
Problem is there are 60+ countries. Can this be done in a different way rather than entering codes of all the countries in the rule?
RewriteRule ^/?(us|uk|ca)/p([0-9]+)/?$
Note the (us|uk|ca) part? A whole lot more need to go in there. Any better way to do this?
But it doesn’t check if the language is a valid one (and I don’t know if you expect language codes with more than 2 characters if such a thing exists)
EDIT : this regexp is shorter :
The first slash is useless and \d+ means one or more digits, see @TerryE’s comment