Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

481
Vistas
Clean urls - When I use a dash for a space, what should I use for dash?

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.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda