Rewriting a number based URL using .htaccess RewriteRule

.htaccess, apache, mod-rewrite, url-rewriting

Solution

your syntax is right, I just remove slash in the end of line and it works:

RewriteRule ^([0-9]+)$ /en/$1

Problem

How can I rewrite a simple number based URL to a sub folder? I want http://mysite.com/123 to redirect to http://mysite.com/en/123. The number could be anything from 1 - 9999. My attempt in htaccess was: ``` RewriteRule ^([0-9]+)$ /en/$1/ [R] ``` But that doesn't work.

Original source