YunoHost-Apps / redirect_ynh

Redirection app for YunoHost
GNU Affero General Public License v3.0
43 stars 21 forks source link

Redirect adds / to the url #36

Open ghost opened 2 years ago

ghost commented 2 years ago

I want to redirect to my.app/de but the redirect app redirects to my.app/de/, which is a broken link

I'm on YH 4.3.6.3 (stable) and Redirect 1.0.1~ynh1

zamentur commented 2 years ago

This PR might fix your issue (depending the mode you select during the setup of the redirection) https://github.com/YunoHost-Apps/redirect_ynh/pull/37

tomdereub commented 8 months ago

Is there a workaround ? Maybe modifying the nginx conf ? I have this in /etc/nginx/conf.d/domain.tld.d/redirect__3.conf :

location / {
  return 301 https://otherdomain.truc/machin$request_uri;
}

And it redirects to https://otherdomain.truc/machin/ which is broken link...

Edit : found a workaround that seems to work :

location / {
  return 302 https://otherdomain.truc/machin;
}

Then sudo /etc/init.d/nginx reload and it's done.

MadMan247 commented 2 months ago

I had a similar issue when installing this application recently, but the extra / was in a different location; instead of redirecting to https://otherdomain.truc/my/page.html, it would redirect to https://otherdomain.truc//my/page.html, which ultimately worked as intended, but was ugly. My solution also required modifying the nginx config.

location / {
  return 302 https://otherdomain.truc/$request_uri;
}

the issue for me was the forward slash between the domain and the $request_uri. After fixing it, a new install for a different domain was performed, and the issue was not experienced this time. Why was the result inconsistent? Are the helpers performing these jobs inconsistent?

EDIT: Just updated my redirects (I have 5.) at least one broke*. The one that had the above "extra slash" issue once again had the extra slash. The one that didn't have that issue still didn't have the issue. Strange.

*Uninstalling + reinstalling fixed it.