Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda