I need to remove the second occurrence of a substring from an url. So, my urls are something like this:
http://example.com/<category>/<category>-<subcategory>-<id>
e.g.
http://example.com/laptop/laptop-hp-probook-101 must be http://example.com/laptop/hp-probook-101
or
http://example.com/computer-parts/computer-parts-cool-motherboard-123 must be http://example.com/computer-parts/cool-motherboard-123
I tried this:
$new_url = preg_replace("$category", "", absoluteurl(<url>), 1);
but it fails...