KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a PHP function that converts a URL to an SEO friendly URL: function seo_url($input){ $input = str_replace(array("'", "-"), "", $input); //remove single quote and dash $input = mb_convert_case($input, MB_CASE_LOWER, "UTF-8"); //convert to lowercase $input = preg_replace("#[^a-zA-Z0-9]+#", "-", $input); //replace everything non an with dashes $input = preg_replace("#(-){2,}#", "$1", $input); //replace multiple dashes with one $input = trim($input, "-"); //trim dashes from beginning and end of string if any return $input; } I know it's pointless for SEO to do this to a URL in javascript, but for the sake of consistency I want URL's to appear the same in my application. Does anyone have the function handy in javascript? :]
Tags (comma-separated)
Save Edits
Cancel