RewriteRule is not working as expected

by nobody   Last Updated April 15, 2019 09:04 AM

This is my current code:

RewriteRule ^test/([\w-]+)/(\d+)$ index.php?page=$1&tab=$2 [L]

With this rule above i can access a URL like this one: example.com/test/example-1/1.

But i can't access this URL: example.com/test/example2/1.

The regex [\w-]+ only works for words that have -. So i tried to make another rule:

RewriteRule ^test/([a-z]+)/(\d+)$ index.php?page=$1&tab=$2 [L]

But it also don't work, even if i change ([a-z]+) to (.*). Why? How can i fix it?

This is my current URL: localhost/public/index.php?page=x&tab=x, and i want to be able to rewrite these URLs bellow:

1 - localhost/public/test/example-1/1

2 - localhost/public/test/example2/1

Update: I realized that to access this URL localhost/public/test/example2/1 i need to change example2 to Example2. I have no idea why...



Related Questions


Updated April 20, 2015 20:01 PM

Updated September 04, 2017 10:04 AM

Updated May 22, 2018 18:04 PM

Updated January 03, 2019 09:04 AM

Updated May 08, 2016 08:01 AM