简体   繁体   English

Laravel Url生成问题

[英]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 我收到此链接:localhost:8000 / dashboard / edit?3

I want to make the url like: localhost:8000/dashboard/edit/3 我想把网址设为: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. 在切换到nginx之前我有一个类似的问题,当使用apache时,似乎我丢失了我的漂亮网址,我不得不做两件事来修复它。 First create a .htaccess file in your public/ directory and put this as the contents: 首先在public/目录中创建一个.htaccess文件,并将其作为内容:

<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. 第二件事是我在我的项目根文件夹中有一个server.php ,我不得不重命名为index.php不知道项目的所有细节的情况下很难确定可能发生的事情,但这对我来说完全相同问题。 Best of luck 祝你好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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