0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Yikes. I should have seen that! :( Thanks for the catch.
@Eric Quite alright, I'm sure we've all been there plenty of times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.