Laravel 5 subdomain index.php problem ( any help ? )

Hello,

I’m using the frameworks laravel, and something strange happen, the link www.mysite.com/laravelsite/ not work, instead www.mysite.com/laravelsite/index.php works fine.

The first link gives me the following error :

NotFoundHttpException in RouteCollection.php line 145:

I think there is a link between this error and the mod_rewrite on my server, no ?

Thanks for your help

Yes, more than likely, your web server isn’t set up properly to route the URL “www.mysite.com/laravelsite/” to “www.mysite.com/laravelsite/index.php”.

Scott

Try creating an htaccess file in your laravelsite folder with the line
DirectoryIndex index.php

I think you are right, but setup my Ubuntu dedicated server correctly ? Knowing that I have another websites in it.

I did that in the .htaccess file in the root of Laravel’s folder, but nothing change…

Did you follow these instructions? (assuming you are using Apache as your web server)

Scott

Unless you have something wonky in your main htaccess file (please post the portions of it that might be involved) I too am thinking it’s a Laravel issue.
Maybe this will hep?

i.e.

Sub-Domain Routing

Laravel routes also handle wildcard sub-domains, and will pass your wildcard parameters from the domain:
Registering Sub-Domain Routes

Route::group(['domain' => '{account}.myapp.com'], function()
{

    Route::get('user/{id}', function($account, $id)
    {
        //
    });

});

Thank you all for your support. Guess where I have been all this time? Unfortunately I made some update of my Ubuntu server and lost it. I could save the data ( content + database), but the whole subject or story bothered me really, and beside this fact I’m happy, really, as I learned a lot about Server management because of what is happened.

Ok back to Laravel 5, I discovered something also strange, each time I transfer .env file ( the one in the root of Laravel directory ) to my server ( myabe because I’m using Ubuntu ), I can’t see the file, so I should create it manually. ( by the way, I’m using Rsync to transfer my files from BACKUP server to the Master server, and I’m using Plesk as Control Panel.

Files and folders that begin with a . (dot) are hidden on *nix systems. Depending on what program you’re using to view the files on the server, you may have to enable an option to view hidden files.

Note that it’s recommended to use the .env file only for development / testing environments and set the variables directly in your server configuration for your production environment.

Thanks fretburner for your support, I’m using Plesk as Control Panel.

I didn’t understand this point, why ? we use this file to keep database information inside, non ? I mean .env file.

The idea behind it is that you shouldn’t store sensitive configuration (like your DB credentials) in the application code, that way developers can work on a copy of the code without needing (or knowing) the server credentials. To make it easier to set up dev environments, Laravel uses the phpdotenv library. That way, a developer can create a .env file with their local DB credentials.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.