1

Due to a client issue i have to put a laravel 4 application on shared hosting service.But i followed this process at [laravelio]which includes.

Place the files of the laravel public folder i.e. css, img, js etc; into public_html folder (don't dump public folder instead dump the files and folders in it).

Put all the remaining folders & files into another folder, say 'laravelcore' and place the laravelcore folder in the root (/home5/username/)

Open index.php in the public_html folder and replace the following lines as mentioned

require DIR.'/../bootstrap/autoload.php';

require __DIR__.'/../laravelcore/bootstrap/autoload.php';

$app = require_once DIR.'/../bootstrap/start.php';

$app = require_once __DIR__.'/../laravelcore/bootstrap/start.php';

Open paths.php file in laravelcore/bootstrap and replace the following line

'public' => DIR.'/../public',

'public' => __DIR__.'/../../public_html',

which is suppose to work but when i visit the url i get this : The requested URL /login was not found on this server.please what may be the problem as i dont get it.may be its about configuring the .htacces file.

Any help would be appriciated.Thanks website is at :benin1897.com

i just discovered that there is no .htaccess file in th public_html folder.could that be the problem...

here is my file tree

(/home/benincom) etc logs mail oysg app bootstrap vendor publicftp public_html css js error_log readme pakage.json robots.txt tmp

NOW AM LOGGED ON BUT LARAVEL THROWS ME ERROR

/ / |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We'll require it | into the script here so that we do not have to worry about the | loading of any our classes "manually". Feels great to relax. | / require DIR.'/../oysg/bootstrap/autoload.php'; / |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let's turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight these users. | / $app = require_once DIR.'/../oysg/bootstrap/start.php'; / |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can simply call the run method, | which will execute the request and send the response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have whipped up for them. | */ $app->run();

2
  • Can you show us an treeview of everything in the way you currently have it? ( not how the docs say it, but how you have it right now ). And maybe an dump of the edited files ( just to verify that there aren't any spelling errors ) Commented Oct 6, 2014 at 12:39
  • It looks like you fixed it? ( if i check your site i see an nice login page) Commented Oct 6, 2014 at 18:03

2 Answers 2

2

Do you've got the route for login handeld in your /app/routes.php like this?

Route::get('/login', 'LoginController@login');

Or if you don't use Controllers ( Which isn't an good idea, but for quick / dirty testing... )

Route::get('/login', function(){
    echo "Now we're going to login on this awesome website!!!";
});

More about the Laravel Routes

Edit 1

The Controller file ( /app/controllers/LoginController.php ):

<?php

class LoginController extends BaseController {

    public function login() {
        echo "Now we are going to login in this awesome website!!!";
        // return View::make('pages/overig/login');
    }

}

You stated that there isn't an .htaccess file in you public folder. There should be one. Create the file and insert this content and try it again:

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
Sign up to request clarification or add additional context in comments.

6 Comments

just added this:Route::get('/help', function(){ echo "Now we're going to login on this awesome website!!!"; }); in my controller but still the same problem persist
@AlofeOluwafemi, Don't add that in your controller. Add that in the /app/routes.php file. I'll add the Controller code
it was added in my route and not my controller.my mistake to have said controller and not route.like this Route::post('/login',['as' => 'login', 'uses' => 'OYSGController@TryLogin']);
@AlofeOluwafemi, The Route::post will be used when you POST an form. If you just navigate to an URL, you need to use Route::get. More info about the Laravel Routing
i get u @Mathlight.am just trying to show to you that i understand how to go about making routes and controllers.atleast my application works locally very well.
|
0

It sounds like the .htaccess file is not configured properly so you are not getting the 'pretty URLs'. Try copying the example file from here to your .htaccess http://laravel.com/docs/4.2/installation#pretty-urls.

In the meantime you should be able to access your application by prepending index.php. For instance /login wasn't working for you, but if you try /index.php/login it will work

1 Comment

yah tanks the /index.php/login worked.. still on the .htaccess though

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.