Larvel issue of changing directory in a droplet

November 26, 2016 530 views
Apache Ubuntu 16.04

I had larvel installed earlier in /var/www/HTML/ now I moved it in some other directory like /var/www/HTML/larvel/public, the larvel login is available at http://example.com/larvel/public but when I login it gets auto redirect to http://example.com/do-login not http://example.com/larvel/do-login , how can I change the base project directory.


1 comment
  • Can you share your Apache configuration and provide a bit more detail about the exact changes you made? The more information you can provide, the easier it will be to help you troubleshoot.

1 Answer

Sorry to see that your question hasn't received an answer yet. Unfortunately, after this much time, it is unlikely an answer for this specific question will be provided without more information.

For people still landing here via search experiencing similar issues, the first place I would suggest to look is the the configuration for the web root in your web server. It should only point to the public/ folder, not the root of the application. For example, if your Laravel app is located at /var/www/html/laravel/ you config might look like:


server {
    listen 80;
    server_name example.com;

    root /var/www/html/laravel/public;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;

Or with Apache:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/var/www/html/laravel/public"

    <Directory "/var/www/html/laravel/public">
        AllowOverride all

Check out this tutorial for more info on getting a Laravel app up and running:

Laravel is one of the most popular open-source web application frameworks written in PHP. It aims to help developers build both simple and complex applications by making frequently-used application tasks (like caching and authentication) easier. In this tutorial, we will deploy a simple Laravel application with a production environment in mind.
Have another answer? Share your knowledge.