For further info on the problem:
This is what index.php does right in the beginning:
$uri = preg_replace("/\/+/", "/", substr($_SERVER["REQUEST_URI"], strlen($cms_path)));
if(substr($uri, 0, 1) == "/") $uri = substr($uri, 1);
if(strpos($uri, "?"))
$uri = substr($uri, 0, strpos($uri, "?"));
if ($uri=="") $uri="/";
$path=explode("/",$uri);
It just takes a url like site.com/categoryA/categoryB/product-name-id-1234 and breaks it down like:
$path[0]=categoryA
$path[1]=categoryB
$path[2]=product-name-id-1234
OR, sometimes:
site.com/categoryA/product-name-id-5678
which is broken down as:
$path[0]=categoryA
$path[1]=product-name-id-5678
The php script then checks $path[1] for a pattern like this: 'id-1234' If it finds it, it runs the query for displaying product details.
If the pattern doesn't match, it simply lists all the products in categoryA.
The problem that I am encountering now is that when it is given this URL:
site.com/categoryA/product-name-id-5678
It is showing the product details page, which is fine, but it is also running Product list query several times, raising CPU usage to 100%.
I think it is quite obvious, looking at the ReWriteLog that it is due to internal redirects to index.php
And if I am right, I need to know how to stop internal redirection.
Thanks