Welcome Guest, Not a member yet? Register   Sign In
Best way to get around using hyphens in controller class names for SEO


Am a bit stuck about how to best go about this and was hoping for a suggestion or two.

I have a site with urls like www.mydomain.co.uk/wooden_tables/family_tables

An SEO company I am working with told me that it would be best to replace the underscores with hyphens which I did not believe, until I googled it, and was suprised to find google themselves say that they use underscores to join words,  and hyphens to seperate them. So they see the example url above as being "woodentables/familytables", not "wooden tables/family tables".

So, stupidly I proceeded to change all my controller classes names and site urls to dashes, without testing one example first, just thinking 'ah, that is news to me but the change will be quite simple to do'. Only to then discover that PHP does not allow hyphens in class names. :-(

So then I thought, I know, I will just use .htaccess to redirect all the underscores, but redirection does not really solve the problem. Then I thought, perhaps I can write a router to reroute the requests, but since this affects the entire site, that would mean writing routes for all the dynamically generated urls.

So I need to be able to use the url www.mydomain.co.uk/wooden-tables/family-tables, be able to list that url as the canonical link and in the sitemaps, use that url in links from other pages, but use a class that has the name wooden_tables and method family_tables.

Does anyone have a suggestion how I should best approach this?

Thanks in advance,

Best wishes,


Messages In This Thread
Best way to get around using hyphens in controller class names for SEO - by PaulD - 02-24-2016, 06:56 AM

Theme © iAndrew 2016 - Forum software by © MyBB