0

Actually I am deploying my laravel 5 Application on Linode Server. My client create space for me in such type of path.

var/www/html/abcproject

I point out my godaddy domain to abcproject directory.

Now I have uploaded my all Laravel 5 files on abcproject directory.

My issue is that , my home page is working fine but my internal pages are giving Not Fount Error.

Suppose when I try to logged in it is giving below error.

Not Found
The requested URL /abcproject/login was not found on this server. 

Secondly Laravel 5 URL is getting url like that.

Supposed URL. http://15.30.19.61/abcproject/index.php/registers

I did not understand where is and what is the issue.

One thing is my project is working fine when I try such type of URL.

http://example.com/index.php/ But In this case my URL Rewriting did not work but project is working like I can logged in, go in different pages, Logout etc.

My HTACCESS FILE

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On


    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

</IfModule>

Thanks

John Brad
  • 447
  • 1
  • 10
  • 26

2 Answers2

1

If you are powering your laravel project from a sub folder such as you mentioned above:

http://15.30.19.61/abcproject

You should add this to your .htaccess file under RewriteEngine On.

RewriteBase /abcproject
  • Second I have created two .htaccess file - 1. on root and 2. on public folder. So on which i need to change ? both or on public htaccess file – John Brad May 19 '17 at 15:06
  • Where is ur index.php located? Root or public? –  May 19 '17 at 15:16
  • On root - I was renamed server.php file to index.php – John Brad May 19 '17 at 15:19
  • In the case such as urs what I usually do is move the index.php and .htaccess files from the public directory into the root directory. Then I modify the index.php file and change the bootstrap includes from /../bootstrap to /bootstrap and then add RewriteBase /projectName to .htaccess and then laravel works on sub folders in apache –  May 19 '17 at 15:20
0

I also faced a similar issue with LAMP configuration and I resolved by enabling rewrite rules of apache. If some needs details then it can be referred at the below blog notes http://ankgne.com/post/setting-up-digital-ocean-for-laravel-application

  • Step 1: Enabling mod re-write using sudo a2enmod rewrite
  • Step 2: Allowing the laravel .htaccess (in public directory of laravel page) file to apply rewrite rules

     sudo vi  /etc/apache2/sites-available/000-default.conf 
    and adding below lines

    Note: Change "/var/www/html" to "path of laravel public folder"



  
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  

  . . .
    

Step 3: Restarting web server using

 sudo systemctl restart apache2