M
M
makecode2015-01-19 16:49:40
PHP
makecode, 2015-01-19 16:49:40

Strange behavior of mod_rewrite?

Hello, this is the situation. Here is the url
domain.ru/shop/larry/
In .htaccess

RewriteRule ^shop/?([a-zA-Z0-9_-]*)[/]?page([0-9]*)[/]?$ ?login=$1&p=$2 [QSA,L]
RewriteRule ^shop/?([a-zA-Z0-9_-]*)[/]?$ ?login=$1 [QSA,L]

In the login variable, I get larry, but it's worth writing like this
domain.ru/shop/larrypage/
Then I still get larry, although it should be larrypage. Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-01-19
@makecode

Because it is necessary to compose rules normally
RewriteRule ^shop/([^/]+)/?page([0-9]+) /?login=$1&p=$2 [QSA,L]
RewriteRule ^shop/([^/] +) /?login=$1 [QSA,L]
domain.ru/shop/(anything but slash)/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question