![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
| SEO Mod for URL Method 2 To satisfy the almighty google, I started fooling around with utils.php after a problem I had with the url input and creation. I wanted underscores in my link titles instead of dashes, which is better seo for directories. i.e. yoursite.com/pligg-is-great/ is now yoursite.com/pligg_is_great/ Is somehow more "readable" to the almighty's standards. I'll post my libs/utils.php makeUrlFriendly function but don't expect it to work for you, it's kinda proof of concept, because my function is hacked up anyway Code: function makeUrlFriendly($input) {
// this function taken from http://us2.php.net/manual/en/function.preg-replace.php#54517
// then modified with the help of "j0zf" and "caomhin"
Global $db;
//steef: remove strange characters in friendly URLs (code by jalso)
//w3c: escape the url using urlencode() when it has to be displayed.
//$input = remove_error_creating_chars(utf8_substr($input, 0, 240));
$input = utf8_substr($input, 0, 240);
// I wanted to keep these in ??? $output = preg_replace("/\b(an?d?|f?o(r|f)|the)\b/i" , "" , $input);
// Replace spaces with underscores
$output = preg_replace("/\s/e" , "_" , $input); //here is the modified line
$output = trim($output);
// Remove non-word characters // this will break unicode chars
//$output = preg_replace("/\W/e" , "" , $output);
//$output = preg_replace( '/(_a_|_an_|_the_|_and_|_or_|_of_|_for_)/i', '_', $output );
$output = str_replace("-", "", $output);
$output = str_replace("--", "_", $output);
$output = str_replace("\"", "", $output);
$output = str_replace("'", "", $output);
$output = str_replace(",", "", $output);
$output = str_replace(".", "", $output);
$n = $db->get_var("SELECT count(*) FROM " . table_links . " WHERE link_title_url like '$output%'");
if ($n > 0)
{return $output . "-$n";}
else
{return $output;}
} ithis is an example... Code: RewriteRule ^story/title/([a-zA-Z0-9-_]+)/?$ story.php?title=$1 [L] Last edited by riggd : 02-18-2007 at 02:14 AM. |
| Sponsored Links |
|
Check out the New Templates at the Pligg Pro Shop.
|
| |||
| renaming - to _ working ok, but modrewrite not all [a-zA-Z0-9] in .htaccess i must rename to [a-zA-Z0-9-_] ? Last edited by daone : 02-18-2007 at 08:55 AM. |
| |||
| where do you get the idea that underscores are better for seo? Everything I've read/seen makes it clear that dashes are much preferred. http://www.mattcutts.com/blog/dashes-vs-underscores/
__________________ http://www.mobilitybeat.com |
| |||
| Well, that article was written in 2005, and about his personal experiences. All I have read says the opposite, but I don't have any links to reference, just many forums and blogs I visit. I can only give you 2 hard examples... 1.Digg 2.If you run adsense, you will get EXTREMELY relevant directed results for underscores in directories. If you have a spare domain, try it out for yourself. If I remember correctly they treat underscores as spaces and drop dashes, lumping the string together. I will hunt for some documentation if you like. I would like to hear what others have read and understand on the issue if anyone else has any information. |
| |||
| |||
| Dashes vs underscores Matt Cutts is the Google spam head; and he is considered the authority in such questions. Most top end SEOs use dashes now. Relevant ads depend on too many other factors. |
| |||
| Having spent the last 3 years as an SEO I would have to place my vote with the dashes over the underscore. We saw such a dramatic improvement when I switched to dashes instead of underscores (which was the company standard at the time) that we ended up going over all our work and changing underscores to dashes. Of course SEO like anything else you can always find someone who has a different view point. |
| The Following User Says Thank You to rlongfield For This Useful Post: | ||
| |||
| Why was the default changed back to underscores? Anyone point me to where I would change this to get back to dashes in the url?
__________________ http://www.mobilitybeat.com |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Has anyone got Friendly Urls (Url Method 2) working? | revolver | General Help | 11 | 05-07-2008 11:32 PM |
| FIX for gzip compression troubles, no .htaccess gzip compression method required | Daniel | Core Development | 8 | 02-16-2007 02:16 PM |
| url method 2 advancement | davebowker | General Help | 10 | 02-11-2007 04:45 PM |
| Url Method page added to Pligg wiki | revolver | Suggestions | 1 | 11-04-2006 06:06 PM |
| URL Method | nish | Bug Report | 4 | 09-16-2006 03:01 PM |





Linear Mode

