I have a portal with multiple categories like PHP, ASP, Java etc. Each of this category has many other subcats. I will take an example and show you what my problem is.
Let's take PHP which has Tutorials as one of the subcats which also has email systems as one of the subcats:
"PHP > Tutorials > Email systems"
If I navigate to PHP my url looks something like this:
"http://www.rdomain.com/PHP,category,1,ID,catlistings"
and if I navigate deeper to tutorials I get the following result:
"http://www.domain.com/Tutorials,category,23,ID,catlistings"
and deeper to email systems:
"http://www.domain.com/Email_systems,category,52,ID,catlistings"
My PHP rewrite function looks this way:
PHP Code:
function make_link ($baseUrl, $varArray = NULL)
{
global $setts;
(string)$output = NULL;
if ('Y' == 'Y')
{
while (list ($key, $value) = each ($varArray))
{
$value = eregi_replace (',', '', $value);
$value = eregi_replace (' ', '-', $value);
$value = str_replace ('\\', '', $value);
$value = eregi_replace ('/', '', $value);
$value = eregi_replace ('&', '', $value);
$value = eregi_replace ('#', '', $value);
$value = eregi_replace (';', '', $value);
$value = eregi_replace ('&', 'and', $value);
$value = eregi_replace ('"', '', $value);
$output .= $value . ',' . $key . ',';
}
$output .= $baseUrl;
return $output;
}
$output = $baseUrl . '.php';
if ($varArray)
{
$output .= '?';
while (list ($key, $value) = each ($varArray))
{
$output .= $key . '=' . $value . '&';
}
}
$output = substr ($output, 0, -1);
return $output;
}
@include_once '../some_arrays_to_output_categories.php';
if ('Y' == 'Y')
{
$valsArray = explode (',', $_REQUEST['rewrite_params']);
$valsCnt = 0;
while ($valsCnt < count ($valsArray))
{
$_REQUEST[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
$_GET[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
$_POST[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
$valsCnt += 2;
}
}
... and the .htaccess:
RewriteEngine On
RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2
THE PROBLEM:
If I navigate to Email systems I want my url to contain the full path like this:
"http://www.domain.com
/PHP/Tutorials/Email_systems.html"
I want it to finish in ".html", I also want to eliminate those commas with a "/" like in the above example.
This should be an easy trick for someone who knows SEO but I suck so badly on this end.
Thanks for the help, if any.