I am facing problem while uploading my laravel project to shared server, microsoft azure. I can't access routes other than / . My route file has following code :
Route::get(/, function () {
return view('welcome');
});
Route::auth();
Route::get('/home', 'HomeController@index');
It's basically I used php artisan make:auth to generate login signup default functionality.
I can access my /route by visiting :
http://40.121.138.22/monrostudio/public/
But can't visit other routes like /login, /register or any other I created.
The page that loads for http://40.121.138.22/monrostudio/public/
according to your link should load when you go to the root route like http://40.121.138.22/
or http://40.121.138.22/home
.
This is how I would troubleshoot it:
1) go to the control panel of your hosting provider and make sure you installed and configured your Laravel project in the public
folder or public_html
, whatever your hosting provider instructions say
2) make sure your set up your domain's DNS according to your host's instructions (I'm 99% sure its not an issue but its worth checking. Hosting Laravel on shared servers is not very straightforward, as I recently found out myself.
3) Check your routes file. Make sure you have you have routes to all the pages you want to go pointing to the existing controllers. Controller for auth
is app\\Http\\Controllers\\Auth\\AuthController.php
. The AuthController
is the one that sends users down the login
and register
path. It is also the one that redirects registered users away from register
page and logged in users away from login
page.
I believe you haven't setup Mod_Rewrite on your server.
Follow below steps for enabling mod_rewrite for Apache Server .
sudo nano /etc/apache2/apache2.conf
(Open apache config file, And find below lines)
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
and change it to
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Then
sudo a2enmod rewrite
And finally
sudo service apache2 restart
And then you will see it working. Hope it helps.
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.