user290043
user290043

Reputation:

mod_rewrite Regex Issue

I have this rewrite rule:

RewriteRule ^/([0-9])+$ http://<domain>/$1/ [L]

And when I got to the site and type:

http://<domain>/596

I am expecting it to redirect me to

http://<domain>/596/

However, it is redirecting me to:

http://<domain>/6/

What am I doing wrong here?

Thanks! :-) Eric

Upvotes: 0

Views: 42

Answers (1)

Orbling
Orbling

Reputation: 20602

The + needs to go inside the brackets.

RewriteRule ^/([0-9]+)$ http://<domain>/$1/ [L]

Otherwise what you are saying is I want one or more matches for a digit, rather than I want a single match with 1 or more digits.

Upvotes: 1

Related Questions