I've migrated my site van Joomla to Joomla 4. I've also moved to articles from K2 to Joomla articles. Over the ast few years there where thousands of articles written, so the redirects component isn't a simple solution for redirecting the old K2 url's to the new url's. I want to fix this with a line of code in htaccess, but my regular expressions skill are apparently not sufficient to get it right.
The old ur's are
Code: Select all
https://mysite.com/menuname/submenuname/item/12345-item-alias
The new url's don't have the /item and I removed the item-id (which differs since the migration) including the trailing dash. The new urls are thus:
Code: Select all
https://mysite.com/menuname/submenuname/item-alias
I thought this line of code would do:
Code: Select all
RewriteRule ^/item/([0-9]+)-(.*)? $1 [R=301,L]
But the result is that the id is still there and that the /menuname/submenuname is also removed:
Code: Select all
https://mysite.com/12345-item-alias