Ad

Laravel 5 Pages Are Not Being Displayed On Live Server

- 1 answer

Main Points: - I am using Laravel 5, apache, and ubuntu - mysite.com is WORKING - mysite.com/login works on localhost, but not on live server

I'm building my first website, and my home page is 'live' (it is up and working) My problems arise when I want to create a 'mywebsite/login' page. I am getting a 404 Not Found error on live, when the page works on my local machine.

I believe this is happening because my .htaccess file not rewriting correctly in regards to my folder structure. The problem is I'm not able to figure it out, as this is all new to me.

My document root is /var/www/laravel/public My .htaccess is in the above folder. It looks like this

<IfModule mod_rewrite.c>
  <IfModule mod_negotians.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]

I have a virtual host file for my site in /etc/apache2/sites-available It's contents look like this

<VirtualHost *:80>
  ServerName mysite.com
  ServerAlias www.mysite.com
  DocumentRoot /var/www/laravel/public

  <Directory /var/www/laravel/public>
    Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
    Allow from all
    Allowoverride All
  </Directory>
  RewriteEngine on

  <Directory /var/www/laravel>
    AllowOverride All
  </Directory>

  **A few more lines...**
</VirtualHost>

I have also enabled mod_rewrite on the server.

I am thinking that I have a smaller 'pointing' error here somewhere, but I'm not experienced enough with these files to see it. Is there anyone that can give me a hand?

Thanks

Ad

Answer

Move All the files on xyz(your folder name for which domain/ subdomain is mapped) folder

Then follow these steps

1 – go to public folder

2 – copy .htacsses file(this make your routes work)

3 -paste it in xyz folder

4 change server.php to index.php

5 – enjoy and happy coding

This is working fine with hostgator.in shared hosting.

Ad
source: stackoverflow.com
Ad