Special characters in URL lead to 404 error


When I use special characters in the permalink of a post, the post cannot be found and I receive a 404 error. This holds even if I use encoded characters. For example, permalink: /%da%86%d8%b1%d8%a7/ results in 404 error too (this encoding is from my WordPress site, which I am considering to migrate to Jekyll, and I want to keep the URLs to avoid SEO problems).

Thanks in advance,

can’t answer your question but if I were you I would redirect the urls, S3_Website is a great tool for publishing to AWS S3 - it handles redirects fairly well.

I suppose your issue could partly be due to the host? are you testing this locally with jekyll serve? maybe this is a limitation of jekylls built in webserver (webbrick)?

If you look at the structure of the _site folder, can you tell if it is doing what you want?

Thank you for your reply.
URL redirects will be the workaround if I cannot succeed with this method.

This happens locally, not on a server.

In the _site folder, for this special post, it creates a folder and inside it, it creates an index.html file. It seems the problem is this extra folder. Other posts with usual English names have an html file in the _site's root.

thats normal, most web servers will know to serve the index doc out of the folder - my questions was more of what is the folder name - is it encoded or not? I’m not sure where I am going with that, just trying to suss it out.

This is the folder name but decoded: چرا

how are you trying to use the url? like mysite.com/mypost or mysite.com/mypost/ the trialing slash is important and is what tells the server to serve the index doc inside. If you are trying to do it without the trailing slash then that is likely your problem, but that can be fixed on the web server depending on how you host it.

I have tried both approaches with no success. So are you saying that it may not load locally, but does actually load on the server?

I don’t know - I’m guessing there is limited support for special characters and that is probably your problem. But trying to help eliminate other things.

1 Like

Are you developing locally on Windows?
Ruby on Windows is known to have encoding issues…

Yes, I am developing locally on Windows. I will test it on Ubuntu to see whether it works.

Thank you. Ruby on Windows was the problem. It works when built on Ubuntu.

1 Like

For anyone with a similar problem, building the website from Ubuntu on Windows (WSL) solves the problem.