0

thank you for reading my question, I have search everywhere in this forum but all of them are still having problem with my site now...

My site is full on Laravel, we are working on Linux Server if you know Digital Ocean... Our problem now is that we cannot access the site beside www.site.com/public, other than that are not. Even we have routing into: Route::get('karyawan','karyawancontroller@index'), when we want to go to www.site.com/public/karyawan, the page is not there, we have set the controller into the blade, named index.blade.php

here is the response from the server: http://postimg.org/image/4x4k9ymtb/

we have done by restarting the apache, mod_rewrite but have no effect... can anyone help us?

Thanks

Yuko Pangestu
  • 193
  • 1
  • 2
  • 19

2 Answers2

1

"what kind of "app" or "everything" that you mean" ............. Copy index.php from your 'public' folder and paste it in your project root folder. (better rename 'public' to some public_xyz , as you are not going to use that any more). After this you need not to have 'public' in your url. Now go to your server.php, and comment this line :
//require_once __DIR__.'/public/index.php';
and make it as

 require_once __DIR__.'/index.php';

Now your URL should look like www.site.com/karyawan

  • Hi Vijay, thank you for the answer, after I changed this and put it on my project root folder, I have the access for the laravel, but when I access the route, the route is not connecting I also changed the bootstrap autoload since this is the problem when I put the index.php into the project root – Yuko Pangestu Feb 12 '16 at 07:11
0

I wonder why you have public in your URL. You should usually keep app and everything beside public outside of your webserver's document root.

However, if you have a mod_rewrite issue you might be able to get further by trying this: www.site.com/public/index.php/karyawan. That way you avoid mod_rewrite.

Remo
  • 4,307
  • 2
  • 10
  • 13
  • Hi, thanks for the fabulous answer, I finally have the access through my site, however if I may ask again... So what kind of "app" or "everything" that you mean? Do you mean that we only have to put everything beside public folder in the app folder? In our folder structure we are putting the laravel inside "/->www->html" We we have another problem, named "PDOException in Connector.php line 55: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)" – Yuko Pangestu Feb 12 '16 at 06:40
  • Check this http://laravel-recipes.com/recipes/25/creating-an-apache-virtualhost Here you can see that they set the document root to the public directory of the Laravel app. That's the way it's supposed to be. It ensures that no other php file can be accessed directly beside the ones that ought to be public. Your other problem is probably a problem with the env file, check .env in the root of your application. – Remo Feb 12 '16 at 09:10