# Special characters in URL lead to 404 error

**URL:** <https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105>\
**Category:** Help\
**Created:** [July 20, 2019, 11:48am UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105 "2019-07-20T11:48:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 20, 2019, 11:48am UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/1 "2019-07-20T11:48:25Z")

</div>

Hi,

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,

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [July 20, 2019, 4:06pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/2 "2019-07-20T16:06:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 21, 2019, 9:06am UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/3 "2019-07-21T09:06:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [July 21, 2019, 3:23pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/4 "2019-07-21T15:23:39Z")

</div>

> [@kavir1698](#):
>
> it creates a folder and inside it, it creates an index.html

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.

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 21, 2019, 3:25pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/5 "2019-07-21T15:25:18Z")

</div>

> [@kavir1698](#):
>
> %da%86%d8%b1%d8%a7

This is the folder name but decoded: چرا

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [July 21, 2019, 5:12pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/6 "2019-07-21T17:12:35Z")

</div>

> [@kavir1698](#):
>
> It seems the problem is this extra folder.

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.

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 22, 2019, 8:20am UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/7 "2019-07-22T08:20:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [July 22, 2019, 4:03pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/8 "2019-07-22T16:03:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [July 24, 2019, 5:26pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/9 "2019-07-24T17:26:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 24, 2019, 5:59pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/10 "2019-07-24T17:59:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 24, 2019, 6:06pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/11 "2019-07-24T18:06:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kavir1698](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/kavir1698/32/1780_2.png) [@kavir1698](https://talk.jekyllrb.com/u/kavir1698)\
**Post date:** [July 24, 2019, 6:24pm UTC](https://talk.jekyllrb.com/t/special-characters-in-url-lead-to-404-error/3105/12 "2019-07-24T18:24:29Z")

</div>

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