Murlidhar Fichadia
Murlidhar Fichadia

Reputation: 2609

Laravel on Shared Hosting pages other than '/' not showing up

Whatsoever I put in Route('/') Directory seems to show up the page:

Route::get('/', function () {
    return view('coming-soon');
});

But all other routes dont seem to work. here :

Route::get('/', function () {
    return view('coming-soon');
});

Route::get('/home', function () {
    return view('home');
});


Route::get('/about', function () {
    return view('about');
});

Route::get('/portfolio', function () {
    return view('portfolio');
});

Route::get('/support', function () {
    return view('support');
});

Route::get('/contact', function () {
    return view('contact');
});

Route::get('/faq', function () {
    return view('faq');
});

Route::auth();

There are no controllers yet defined. Its just plain html and css files.

In Views :

I have files :

home.blade.php
about.blade.php
contact.blade.php
coming-soon.blade.php
faq.blade.php
support.blade.php
portfolio.blade.php

in Layouts Folder
    - app.blade.php

In order for the framework to work I have put all the files in public folder to root directory. That is, css, html(or blade.php files), js folder, images folder

Everything seems fine just that other url's trigger : Error 500 - Internal Server Error If I go to www.example.com/public/about or /home or /contact it works but then no css property applied.

How can I best place the files in Shared-Hosting for it to work.

Any Help is Appreciated!!

Upvotes: 0

Views: 341

Answers (1)

Ravisha Hesh
Ravisha Hesh

Reputation: 1504

Change

require __DIR__.'/../bootstrap/autoload.php'; to require __DIR__.'/../YourProjectName/bootstrap/autoload.php'; and

$app = require_once __DIR__.'/../bootstrap/app.php'; to $app = require_once __DIR__.'/../YourProjectName/bootstrap/app.php';

on index.php

Upvotes: 0

Related Questions