/ Published in: PHP
If you have a title, for something like a blog or product, and want to make an seo-friendly name to call it, here is a function.
SAMPLE INPUT: $title = "This foo's bar is rockin' cool!"; echo makeseoname($title); //RETURNS: //this-foos-bar-is-rockin-cool
Expand |
Embed | Plain Text
function make_seo_name($title) { }
Comments
Subscribe to comments
You need to login to post a comment.

snipplr's version of this removes dashes from the title (see URL in your browser for example! Thx to section31, this one leaves dashes and underscores intact.
Great, just what i needed! Thanks a lot :)
Great. And now for the german SEOs...
function makeseoname($title) { $title = pregreplace('/ä/', 'ae', $title); $title = pregreplace('/ö/', 'oe', $title); $title = pregreplace('/ü/', 'ue', $title); $title = pregreplace('/ß/', 'ss', $title); return pregreplace('/[^a-z0-9-]/i', '', strtolower(str_replace(' ', '-', trim($title)))); }
Thanks for this l was looking for this for my seo companies blog