简体   繁体   中英

Laravel 5.2 Routes Not Working

I just moved a homestead laravel installation to my own vps setup.

Everything is working fine on the homepage ( XX.XX.XX.XX/public ).

But when i click ay links on the homepage it goes to XX.XX.XX.XX/link instead of XX.XX.XX.XX/public/link as i whould think it should.

I have a local setup with homestead and a link like this one XX.XX.XX.XX/signin whould work fine.

And when i try XX.XX.XX.XX/public/signin on the vps it gives a 404 error.

In my sites-available i have setup the below .conf file.

<VirtualHost *:80>
        ServerName XX.XX.XX.XX/app.domain.dk
        DocumentRoot /var/www/app.domain.dk/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/app.domain.dk/public>
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

What could be the problem, please help me : )

The problem is in wrongly configured web server. You should point web server to a laravel_project/public directory and use URLs like XX.XX.XX.XX/link instead of XX.XX.XX.XX/public/link .

For Apache you can use these directives:

DocumentRoot "/path_to_laravel_project/public"
<Directory "/path_to_laravel_project/public">

Don't forget to restart web server.

Solved.

I figured out i was missing a forward slash in my .conf file.

So it should be /var/www/app.domain.dk/public/

Thanks for the help everybody :)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM