I have a page that creates a link (clean url) to an article
weburl.com/Title-article
A RewriteRule in .htaccess then rewrites the url to
weburl.com/articles.php?title=Title-article
On articles.php I'm displaying the title after SQL security checks and changing the dash into a whitespace.
$title_dashed = trim_strip_data($_GET['title']); //trim_strip_data() is a custom function that strips unnecessary characters like backslashes and extra white space.
$title = preg_replace("/[-]/", " ", $title_dashed);
echo "$title";
This all works fine but what should I do / use when I have a dash in the title (fe. "T-shirts") and I want that dash to be displayed and not to be removed from the title?
Titles can be user generated and I don't want to restrict dashes in the title.