PDA

View Full Version : howto remove the category and post ids from sef urls..


connectr
02-12-2009, 04:59 AM
hi guys,
i know this is prob a bit pradantic, but could someone point me in the right direction where i can remove the -id's from the sef urls? i had a look in includes/vba_dyna_functions.php, as per this post http://www.vbadvanced.com/forum/showthread.php?t=25549&highlight=remove+ids+sef+urls and i can see where the id is being set (i think)

line 608 i change this:
return str_replace(' ', '-', preg_replace("/[^a-z_0-9 -]/i", '', strtolower(html_entity_decode($text)))) . '-' . $id;

to this:
return str_replace(' ', '-', preg_replace("/[^a-z_0-9 -]/i", '', strtolower(html_entity_decode($text))));

Then further down on line 629, i changed this:
$link .= $vba_options['dyna_spider_cattext'] . '-' . $cats['catid'] . '/';

to this:
$link .= $vba_options['dyna_spider_cattext'] . '/';

Unfortuntely that does seem to have any effect. It feels like i am missing something obvious?

Any suggestions would be much appreciated..

Cheers,
Chris

Brian
02-12-2009, 11:42 AM
Category links are stored in a cache, so you would need to edit one of your categories through the Admin CP and save it to update the cache. If you've removed the id's from your URL's though you're links are not going to work since the script wouldn't have any way to know what category you're clicking on.

Our Sponsors
 

connectr
02-12-2009, 11:59 AM
Hey brian :)
Thanks for the headsup on the cache - that makes sense now..

Regarding not having the id's in the url - is this a limitation with vbadvanced? all the sef plugins i have used have always worked perfectly fine without any id's in the urls, including vbseo which outputs the sef urls perfectly.

Sorry if i'm being a noob, i am still new to vb in general and still need to get my head around how everything works.

Thanks again for taking the time to reply :)

Cheers,
Chris

Brian
02-12-2009, 12:28 PM
Passing the ID is going to be necessary with any product, including vBSEO (unless they've come up with some weird new method I'm not aware of). The ID is the only way you can truely determine which entry/thread/whatever it is that a script needs to pull. Even with some customization, if you were to only enter the title within the URL, then you would run into issues if you have two entries/cateogries/whatever with the same title. Besides those things, it also would not be efficient from a coding and sever standpoint since it's faster and less server intensive to pull the entry according to the ID rather than trying to match up the title in the database.