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

159
Vistas
javascript: Uncaught SyntaxError: Unexpected token '<' when there is trailing slash at the end of the url

I have all html of my site in index.php.
what I am doing is whenever someone clicks on blog button. I am using pushState to change the url and show/hide different section based on the url

history.pushState({}, '', '/blog/');

and on nginx server what I did is if any page reload happens load the index.php page.

so if someone reload the page from /blog/ at initial state the index page will load and on javascript I am handing the url like this

switch (window.location.pathname) {
  case '/blog':
    // show blog page
    showSection(blogSection, 'Blog');
    break;

everything works as expected if I remove the trailing slash when pushState(). But I need to keep the trailing slash. how can I achieve this?

about 4 years ago · Juan Pablo Isaza
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