'Change part of url using htaccess removing query parameters
I want to redirect a series of urls using part of the urls and deleting the query parameters.
ORIGIN: https://mywebsite.com/category/string-1029?query=1
TO: https://mywebsite.com/mycategory/1029
As you can see the only thing I want to take advantage of is the numerical code (1029 in the example) of the url (which is the one that changes), to create another path with my own subdirectory and the code itself.
So far I have been able to do this, but it doesn't seem to work.
RewriteCond %{QUERY_STRING} (^|&)query=1($|&)
RewriteRule ^category/string-(.*)$ /mycategory/$1 [L,R=301]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
