Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Response is 404 - Can You Fix it #38

Open
SH20RAJ opened this issue Feb 6, 2024 · 4 comments
Open

Server Response is 404 - Can You Fix it #38

SH20RAJ opened this issue Feb 6, 2024 · 4 comments

Comments

@SH20RAJ
Copy link

SH20RAJ commented Feb 6, 2024

The server is responding the page as 404
Screenshot 2024-02-06 at 1 30 57 PM

because you are serving it from 404.html of GitHub Pages and I know it doesn't create a big impact on this type of website but for making a content site like blogging website google doesn't index the 404 pages and that's why your website https://emgithub.com/ is not on google search results.
Screenshot 2024-02-06 at 1 33 53 PM

Solution Approach

  • Either set the 404 response to 200 (but how ?)
  • Or Use another approach to built custom and clean URLs without having it....
@SH20RAJ
Copy link
Author

SH20RAJ commented Feb 6, 2024

Waiting for your response with the solution....

@yusanshi
Copy link
Owner

yusanshi commented Feb 6, 2024

Thank you for pointing out this problem. I didn't realized this before.

I have searched but it seems that for GitHub Pages it's is not possible to change the status code...

With a custom server it should be possible to server as 200 for all not-found requests:
https://github.com/yusanshi/emgithub?tab=readme-ov-file#use-your-own-web-server

image

Also, if we use other hosting service other than GitHub Pages, like Vercel and Cloudflare, it may be possible to do this trick. However, that's gonna make things messy...


Basically, the 404 mainly occurs in two places:

For the main page, I have added index.html which is a symbolic link to 404.html: 8864988. Now requesting the main page would result in a 200, so hopefully the site can be later included by Google search.

image

For the embedding page, I still have no clean methods with GitHub Pages. But I believe 200 for the main page would be enough.

What do you think?

@SH20RAJ
Copy link
Author

SH20RAJ commented Feb 8, 2024

I think for ranking your site (emgithub) on Google. You should try google search console + analytics. ( because this gem deserves to be popular )
2 Years before I found this repo and cloned it here
The main thing is that I learned from your repo (trick/technique) that how a 404.html can handle all other requests and we can do rest of the things using JavaScript (Parse URL and extract Parameters)

And I made ArticlePlanet Taking Inspiration from dev.to for Markdown Article.
I almost completed the website here without database I was using GitHub Gists for Article Hosting and also getting backlink from there for good SEO. Here See Article

But My Articles wasn't ranking I thought it's because I'm loading content dynamically using GitHub API.
But I saw search console is blocking to rank it, then I understood that's it's because 404.
That was the story part.
Now whats the solution.
For You ( You don't have to rank other other URLs other than Home Page URL )

But for me I have to rank all pages of the ArticlePlanet.

See This URL is being ranked. https://articleplanet.github.io/post.html?id=73486096e84d29a730fb3a9a827ee893 (200 Response )
but https://articleplanet.github.io/posts/73486096e84d29a730fb3a9a827ee893 ( 404 Response )
Despite Both Links works same.
HTML same (little differ)

Now, If you want then you may show some solution to me also maybe by using the second solution approach I shown you i.e.

Or Use another approach to built custom and clean URLs without having it....
Knowing (you - I have searched but it seems that for GitHub Pages it's is not possible to change the status code...)

means can we build custom URLs without using this technique o "GitHub Pages". (i.e. jekyll, cofigyml, workflow, actions, etc)

and if it's not possible the you said about the tricks for other hosting.

Also, if we use other hosting service other than GitHub Pages, like Vercel and Cloudflare, it may be possible to do this trick. However, that's gonna make things messy...

You can also show some way for that :)

if you want waiting for your response (eagerly)

.
.
.
.

https://github.com/ArticlePlanet/articleplanet.github.io

@yusanshi
Copy link
Owner

yusanshi commented Feb 8, 2024

Sorry but I have no experience with Vercel or Cloudflare, so I don't know how to do the trick with them 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants