-1

i wrote

rewrite ^/([\w_]+)/?$ /index.php?$1

btw, i wanna except /empty.

hmm..

wanna use

/alphabet -> alphabet
/emptyABC -> emptyABC

/empty -> not match

/emp -> emp

/emptAB -> emptAB

How can I make regular expressions for these?

1

1 Answer 1

0

Not sure if i understood correctly what you want, but i think you need something like this:

rewrite ^/(.+)$ $1;

The + will require at least 1 character to be behind the /. Then it takes whats behind the leading / and redirects to it.

Your examples could also imply that you want to only capture alphanumeric characters, which would be like this:

rewrite ^/([a-zA-Z0-9]+)$ $1;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .