M
M
Mark2019-12-19 14:50:28
htaccess
Mark, 2019-12-19 14:50:28

How to remove using cnc (&id=)?

Hello, please tell me how to make a CNC condition to get rid of &id= in the link
. Now it opens like this: /news&id=35
If I remove id= from the url, then the page along the path /news&35 also opens correctly.
But this is wrong, that's why the question , how to make the page open like this: /news/35
+ there was a redirect from the page /news&id=35 id changes dynamically, depending on the news)
Please help me understand this situation) The brain blew up on this task.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2019-12-19
@shambler81

it's all just a mistake in TK
you think that RewriteRule can work with GET, and it, in turn, is not part of the url,
as a result, you need to highlight it in a different way;)

RewriteCond %{QUERY_STRING} (^|&)id\=(.+)($|&)
RewriteRule ^index\.php$ /%1/? [L,R=301]

%2 - second group from RewriteCond

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question