Iron Brew
Iron Brew

Reputation: 21

my views cannot be found when rendering to browser on a shared hosting (Laravel 5.6)

I have upload a website that i'm still working on, on a shared hosting and Its working alright but when I navigate to other pages it says not found but the view files are all present. It only renders the index view. Any assistance is highly appreciated. here is the nav tab

  <nav class="mdl-navigation">
        <a class="mdl-navigation__link" href="/">Home</a>
        <a class="mdl-navigation__link" href="/about">About Us</a>
        <a class="mdl-navigation__link" href="/support">Support</a>
        <a class="mdl-navigation__link" href="/contact">Contact us</a>
      </nav>

My controller class

    class PagesController extends Controller
{
    //homepage
    public function index(){
        return view('pages.index');
    }

    //about page
    public function about(){
        return view('pages.about');        
    }

    //support page
    public function support(){
        return view('pages.support');
    }

    //contact page
    public function contact(){
        return view('pages.contact');
    }
}

And my routes

Route::get('/', 'PagesController@index');
Route::get('/about', 'PagesController@about');
Route::get('/support', 'PagesController@support');
Route::get('/contact', 'PagesController@contact');

Upvotes: 0

Views: 46

Answers (2)

Iron Brew
Iron Brew

Reputation: 21

Found the solution. I uploaded the files as a zip folder to the cpanel and for some reason I think I did not have all the files uploaded hence, the not found issues. But I cloned the files from a git repo and still maintained the code for the navigation and it worked nicely.

Upvotes: 0

Elisha Senoo
Elisha Senoo

Reputation: 3594

The problem is with your navigation url in the html. Rewrite it as follows:

<nav class="mdl-navigation">
        <a class="mdl-navigation__link" href="">Home</a>
        <a class="mdl-navigation__link" href="about">About Us</a>
        <a class="mdl-navigation__link" href="support">Support</a>
        <a class="mdl-navigation__link" href="contact">Contact us</a>
      </nav>

Or a better this way:

<nav class="mdl-navigation">
        <a class="mdl-navigation__link" href="{{url('/')}}">Home</a>
        <a class="mdl-navigation__link" href="{{url('/about')}}">About Us</a>
        <a class="mdl-navigation__link" href="{{url('/support')}}">Support</a>
        <a class="mdl-navigation__link" href="{{url('/contact')}}">Contact us</a>
      </nav>

Upvotes: 1

Related Questions