简体   繁体   中英

Laravel Url generating issue

When I put this

     <a href="{{ Route('admin.edit', $consignment->id )}}" >...</a>

I get this link: localhost:8000/dashboard/edit?3

I want to make the url like: localhost:8000/dashboard/edit/3

What should I do ? Would you please help me ?

I had a similar issue a while back before switching to nginx, when using apache it seemed I had lost my pretty urls, and I had to do two things to fix it. First create a .htaccess file in your public/ directory and put this as the contents:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

and the second thing was I had a server.php in my project root folder which I had to rename to index.php Without knowing all the details of your project its hard to determine what could be happening but this worked for me with the exact same issue. Best of luck

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM