YunoHost-Apps / grav_ynh

Grav, a flat-file CMS packaged for YunoHost
https://getgrav.org/
GNU General Public License v3.0
16 stars 12 forks source link

"?q=/fr/" added to the url #72

Closed Fazarel closed 3 years ago

Fazarel commented 3 years ago

Describe the bug

YunoHost 4.2.6.1 (stable) / Grav v1.7.17

Hello,

For a multilingual site, I use a menu to change the language via the plugin LangSwitcher. On the home page when I change the language, a piece is added to the url, like "?q=/en/". The links in the menu have the form: <a href="/es/"> On the other pages, when I change the language the url format is the expected one and no "?q=/es/" added at the end. The links in the menu for these pages have the form: <a href="/fr/page">

This is a minor bug that does not prevent the site from working but it is not the normal result.

I guess it's related to conf/nginx.conf? Maybe this part?

if (!-e $request_filename)
{
rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
}

I don't know if I can change anything in this code?

tituspijean commented 3 years ago

Hello, thank you for your report! I had noticed that too, and found it disgracious also, but never took time to look into it. 😅

I think I have found a solution, it works on my server. Can you try it too? (do not worry, you will fall back to the standard code upon next upgrade)

yunohost app upgrade grav -u https://github.com/YunoHost-Apps/grav_ynh/tree/enh-nginx --force

Fazarel commented 3 years ago

Hi, I applied the changes you outlined in the pull request and it works! Thank you.

But I wonder: if it's related to a nginx bug as explained here, when the bug will be fixed this workaround will cause problems?

tituspijean commented 3 years ago

Thanks for your testing!

The issue arose because we used a rewrite command in the config. To avoid that, we can solely rely on try_files, but then we face the bug you evoke. It is quite old (https://trac.nginx.org/nginx/ticket/97 : 9 years!), but I will be swift with an update if it is fixed some day. 😉