How to make github pages url case insensitive?

前提是你 提交于 2019-12-19 05:57:11

问题


Website works for
jerrygoyal.github.io/Flash-Clipboard

but not for (404 error):
jerrygoyal.github.io/flash-clipboard
jerrygoyal.github.io/FLASH-clipboard
jerrygoyal.github.io/flaSH-CLIPboard and so on
You get the idea! How can I make the url case-insensitive?

I've never worked on Jekyll and not sure if my project pages are using jekyll or not. I only created an index.html page and put inside the docs folder of the repository.

I'm using a custom domain (www.jerryfactory.com) to map jerrygoyal.github.io


Here's the URL to my Github Organisation site : https://github.com/JerryGoyal/jerrygoyal.github.io

And URL for my Github project site: https://github.com/JerryGoyal/Flash-Clipboard/tree/master/docs

I'm thinking of moving my project site content to my Github Organisation site if it's possible. So if the URL case insensitivity works for only Organisation site it's fine.


Ref: Org and Project Site in Github


回答1:


How can I make the url case-insensitive?

The short answer is: You cannot / It's not possible in GitHub Pages as of this writing.


The long answer is: Having URLs case-sensitive is a web standard and most webservers will respect that. This has nothing to do with Jekyll or any other similar tool. It's a responsibility of the webserver that serving the HTML pages that were generated by Jekyll, and in the case of GitHub Pages, they use a *nix-based webserver that is compliant with case-sensitive URLs when locating resources.

The common way to solve this problem is to always make sure your pages in Jekyll are always lower-case, which in turn will generate lower-cased URLs.

This shouldn't really be a problem, unless your users are typing the URLs by themselves... And in that case, if you want to be proactive, you can use the jekyll-redirect-from plugin and create redirect entries of the most common ways you believe users will try to access each page.

For example, having the main URL as

  • caioproiete.github.io/flash-clipboard

and redirect the ones below to the main one above via jekyll-redirect-from

  • caioproiete.github.io/Flash-Clipboard
  • caioproiete.github.io/FLASH-CLIPBOARD



回答2:


You can’t make it case-sensitive. Sorry. Case-sensitive URLs are a web-standard. It would be cool if URLs were case-insensitive, but that isn’t true.



来源:https://stackoverflow.com/questions/48388057/how-to-make-github-pages-url-case-insensitive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!