简体   繁体   中英

ALL possible issues of 404 NOT found laravel 6

I've been stuck in a weird problem for a couple of days. All my web application routes are working fine except one. Its has a 404 not found issue. So I checked:

  1. My Routes list. It exists.
|        | GET|HEAD      | dashboard/profile/create                                                      | profile.create                   | App\Http\Controllers\Dashboard\ProfileController@create                                            | web
  1. URI in Routes list & Request URL in search box matches. Request URL: http://localhost/CMSsk/CMS/public/dashboard/profile/create

  2. Checked my blade Layout. No Problems.

<a href="{{ route('profile.create') }}" class="nav-link"><i class="fas fa-briefcase fa-2x mr-2"></i>Add Credentials</a>
  1. Cheked Controller. It exists.
public function create()
    {
        $user       = Auth::user();
        return view('Dashboard.Profile.profile-create',compact('user'));
    }
  1. Cheked Apache2 Rewrite module (Enabled) & Override ALL.

在此处输入图像描述

  1. Used PHPUnit & Chrome Browser devtools to check networks,console,Apllication Cookies,storage. Can't find any issues other than 404.

  2. Used PHPUnit testing and XDebug,dd() to trace problem. The Code doesn't reach Controller method.

  3. Checked ALL possible Stack Overflow issues. Did not solve the problem.

  4. Cleared browser Cache.

  5. Did:

php artisan route:cache

Q: What are other possible issues that I might not have checked to solve this simple yet complicated issue?

Note: I referenced the form Page from another page which has a Social Media Sharing 3rd party Plugin Installed(AddThis). Hence I tried other form pages & other links from there and it works. So I'm confused why Only one page has issue(I thought the Plugin may have effect).

Update:

I fixed the Solution but I wanted to share how I did just so that anyone who stumbles upon this scenario finds some help.So here it goes:

Solution:

I created a Route group first which had the prefix named profile . It had 19 routes. Immediately after that I Created a Resource Route which had it's name prefix . So the two Identical names had a conflict for which I was not getting the page.

How I figured out:

I almost ran out of all possible solutions. So I started Manually testing the routes just to figure out if there's a pattern developing. I know it's not the most effective way but I wanted to figure out a pattern that's why I did it. After testing the Route group prefix named profile I figured out that all routes inside this group are NOT working from where I called it. Then I tested Routes outside that group from that specific blade view and it was working. So I changed the name of the Resource Route just to make it distinct from the Route group prefix . And it worked!

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