Reply
mod_rewrite help
Old 12-21-2006, 11:49 PM mod_rewrite help
Experienced Talker

Posts: 31
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 ($output0, -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.
__________________
Scripts downloads
manilodisan is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to mod_rewrite help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11307 seconds with 12 queries