Alright, so what I just ended up doing was adding a bit of a hack to
cake/libs/router.php and app/config/bootstrap.php.

In the Router::url(), I changed the last line:

return $output . $extension . $_this->queryString($q, array(),
$escape) . $frag;

To this:

$url = str_replace('_', '-', $output . $extension . $_this->queryString
($q, array(), $escape) . $frag);
return $url;

Then I added this to the top of my bootstrap:

$_GET['url'] = str_replace('-', '_', $_GET['url']);

Total hack? You betcha. But it works for now.


On Jul 27, 10:56 am, Jamie <jamie....@gmail.com> wrote:
> Yes, I know this issue has been raised in the past (a long while ago),
> but there's been no satisfying answer yet.
>
> Basically, best SEO practices say that we should be using hyphens
> instead of underscores in our URLs, since search engines such as
> Google have an easier time parsing "my-page", rather than "my_page",
> as two separate words (and thus a distinct search term). Is it time
> for Cake to look at allowing hyphens instead of underscores in URLs?
>
> Before anyone says "OMG you can just do this" (as Nate suggested 
> athttp://trac.cakephp.org/ticket/1727):
>
> $_GET['url'] = str_replace("-", "_", $_GET['url']);
>
> that's fine for parsing incoming URLs, but it doesn't even come close
> to providing a solution since links generated by the Cake router (i.e.
> via the HtmlHelper etc.) use underscores instead of hyphens, and
> that's that. So for those of us who want to use hyphens instead of
> dashes, we need to enter manual URLs instead of using Cake's routing
> capabilities. So, sure, we can translate incoming links, but we can't
> generate the proper links in the first place.
>
> Has anyone thought of a solution? Is the Cake team contemplating
> adding support for multiple URL separators? Any home brew hacks out
> there?
>
> - Jamie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to