Skip to content

Getting 404 on the relative paths for my website after adding another repository with gh-pages #50269

Closed Answered by aadictive
aadictive asked this question in Pages
Discussion options

You must be logged in to vote

To wrap this thread up!

I found the solution to my problem in the comment in a separate discussion. This solution is a temporary fix, but it worked like a charm!

FYI, the routing issue is a known issue in GitHub pages!

So first you will need to add a new page named 404.html to your repo.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>GitHub Pages Issue</title>
    <script type="text/javascript">  
 
      var pathSegmentsToKeep = 0;

      var l = window.location;
      l.replace(
        l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
        l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
        l.pathname.slice(1).split…

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@Anmol-Baranwal
Comment options

@aadictive
Comment options

Comment options

You must be logged in to vote
1 reply
@aadictive
Comment options

Comment options

You must be logged in to vote
4 replies
@cchanyu
Comment options

@Tarungarg98
Comment options

@HunterCoders
Comment options

@aadictive
Comment options

Answer selected by aadictive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pages Host a static website, right from your repo General
5 participants