Этот RegEx может помочь вам написать свой RewriteRul:
^(.+\.html)(\?.+)$
![enter image description here](https://i.stack.imgur.com/J9GxJ.png)
Я не совсем уверен,но ваш код может выглядеть так:
RewriteCond %{QUERY_STRING} .
RewriteRule ^(.+\.html)(\?.+)$ http://domain_goes_here/$1 [NC,L,R=301]
RewriteCond %{QUERY_STRING} .
RewriteRule ^(.+\.html)(\?.+)$ http://domain_goes_here/$1 [NC,L,R=302]
Вам также может понадобиться:
- перезапустить apache
- удалить кеш браузера
Если вы хотите добавить границы к своему выражению, этот RegEx может помочь вам сделать это:
^(\/detail\/[0-9-]+\/news\/[a-z0-9-]+\.html)(\?.+)$
![enter image description here](https://i.stack.imgur.com/HFne1.png)
Код:
RewriteCond %{QUERY_STRING} .
RewriteRule ^(\/detail\/[0-9-]+\/news\/[a-z0-9-]+\.html)(\?.+)$ http://domain_goes_here/$1 [NC,L,R=301]
RewriteCond %{QUERY_STRING} .
RewriteRule ^(\/detail\/[0-9-]+\/news\/[a-z0-9-]+\.html)(\?.+)$ http://domain_goes_here/$1 [NC,L,R=302]