Search code examples
phplaravelapachexamppwindows-10

Laravel view working in production but not locally


When I go to a specific url on my local machine using XAMPP

enter image description here

In the production server

enter image description here

Locally the request has no response data available

enter image description here


There are other pages which use the same headers and footer as this one and they load fine both locally and in the production server.

Here's what the edit looks like

/**
 * Show the form for editing the specified resource.
 *
 * @param  \App\OrganizationUser  $org_user
 * @return \Illuminate\Http\Response
 */
public function edit(Request $request, OrganizationUser $org_user, Organization $model1, User $model2)
{
    // Check if user is admin
    $auth_user = Auth::user();

    $path = $request->path();

    $organization_id = (int)explode('/', $path)[1];

    $user_id = (int)explode('/', $path)[3];

    //dd($org_user->load('user')->load('organization'));

    if($auth_user->isAdmin()) {

        return view('organizations.users.edit', [
                                                'org_user' => $org_user->load('user')->load('organization')->where('id', $user_id)->first(),
                                                'organizations' => $model1::where('id', $organization_id)->get(['id', 'name']),
                                                'users' => $model2->get(['id', 'name'])
                                                ]);        
    
    } else {


        abort(404);

    }
    
}

What have I tried so far

  1. Clear configuration cache
php artisan config:clear
  1. Clearing route cache
php artisan route:clear
  1. Clearing view cache
php artisan view:clear
  1. Clearing event cache
php artisan event:clear
  1. Clearing application cache
php artisan cache:clear
  1. Clearing all cache
php artisan optimize:clear
  1. Clearing content from Composer's cache
composer dump-autoload
  1. Clearing NPM cache
npm cache clean --force
  1. Use a different browser (tested both in Chrome and Firefox).

  2. Restart Apache through the XAMPP console.

  3. Restart the computer.


Edit

Upon request, here's the .htaccess present in the /public folder

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

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

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

Solution

  • The way I've managed to make it work was to disable XAMPP's Apache and run instead

    php artisan serve
    

    Now I'm able to use it just fine.

    enter image description here