I'm using Laravel, and have a view structure like such:
Each of my pages have a navbar at the top, and the navbar has a few links on it:
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a href="mykennel/info">KENNEL INFORMATION</a></li>
<li><a href="mykennel/parents">SIRES & DAMS</a></li>
<li><a href="mykennel/litters">LITTERS</a></li>
<li><a href="help/breeder">HELP</a></li>
</ul>
If I click one of these links (lets say info) from the homepage (home.blade.php), it redirects to the following url:
localhost:8080/mykennel/info
However, if I'm already on a view that is in the mykennel subfolder (again, lets say I'm on the info page), and I click a link from the navbar, it redirects to:
localhost:8080/mykennel/ mykennel /info
Which throws a 404. I understand WHY this is happening but I can't seem to find how to fix it. How can I create an href in my anchor tag that knows to use only a single /mykennel/ prefix, regardless of where the user is currently situated on the site?
Any help is appreciated.
Try to use an absolute path instead, by adding /
at the beginning of the href
so links:
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a href="/mykennel/info">KENNEL INFORMATION</a></li>
<li><a href="/mykennel/parents">SIRES & DAMS</a></li>
<li><a href="/mykennel/litters">LITTERS</a></li>
<li><a href="/help/breeder">HELP</a></li>
</ul>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.