Generah Ben
Generah Ben

Reputation: 15

.htaccess only pick first number in id

I have done some research to know how to use the .htaccess file but i'm now facing an issue I know have a solution.

i have a url like this http://localhost/mycup/check/?download=4 and i use this below rewrite rule which works fine.

RewriteRule ^check/([0-9]) check/?download=$1 [NC,L]

Now, the issue is, the rewrite rule work for download=1 to download=9. If download changes to download=10, 11, 12...19 it will only return download=1.

If download changes to download=21, 21...29, it will return only the first digit which is 2. if it is 9824, it will return 9. Kindly help

Upvotes: 0

Views: 70

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

This is because you literally wanted that with the ([0-9]) pattern. If you need more digits you should write i.e. ([0-9]+) instead.

In general read about regular expression prior writing rewrite rules.

Upvotes: 1

Related Questions