Laravel URL重定向回原页面

huangapple go评论89阅读模式
英文:

Laravel URL redirecting back

问题

我在使用 <a href="f/{{$f->id}}"> 时遇到了这个问题,它会将我重定向到当前路径 + 当前路径。例如,当我在以下路径时:

> localhost:8888/f

当我点击 <a href to e/{{$e->id}}" 时,它给我返回了以下路径:

> localhost:8888/f/e/888.

有人知道为什么它会存储当前的 URL 吗?即使我在菜单中点击,它也会返回相同的 URL。

谢谢!

英文:

I have this problem when using <a href="f/{{$f->id}}"> it redirects me to the path + the current path . for example I am in

> localhost:8888/f

when I click the <a href to e/{{$e->id}}" it gives me

> localhost:8888/f/e/888.

Do anyone have an idea why it stores the current url ? even if I click in the menu it return the same.

Thank you

答案1

得分: 3

如果

href="x/x" 您将重定向到 .com/whaevery/x/x

然后如果您更改

href="/x/x" 然后您将重定向到 .com/x/x

因此,您必须设置基本路径

英文:

if

href="x/x" you will redirect like .com/whaevery/x/x

then if you change

href="/x/x" then you will redirect to .com/x/x 

So you must set the base path

huangapple
  • 本文由 发表于 2020年1月6日 22:43:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/59614051.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定