Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!