php - Laravel 5.1 - Remove "public/" of the URL whith Method bind? -


i need please, i'm beginner laravel , mvc. want remove "public/" of url.

the 2 "solutions" found in google, are: either .htaccess. me (and not me) it's not working. either putting in "public" folder @ root of project laravel. not security reasons.

there real solution remove "public/" url? example url:

localhost/laravel/public/test

accessible url:

localhost/laravel/test

because if or has no solution, of no use continuous take courses on frameworks.

_i had read, there may solution in appserviceprovider:

http://www.creerwebsite.com/medias/upload/larav2.png

or in router or container:

app::bind('path.public', function() { return base_path().'/public_html'; 

});

but beginner, not find solution.

thank you.

the best option configure local installation of wamp use laravel's public folder document root. have 2 options here:

option 1. use wamp project alone

  1. find httpd.conf file. server config, , should located in c:\wamp\bin\apache\apache2.4.4\conf. (it's idea make backup of file before editing)
  2. open config file in notepad, find line documentroot "c:/wamp/www" , change documentroot "c:/wamp/www/public" (assuming have laravel project in www folder)
  3. save httpd.conf , restart wamp.

now when visit http://localhost should see laravel welcome screen.

option 2. set virtual host

this option bit more complicated, allow have multiple websites running alongside each other in wamp, each own subdomain can use access them in browser.
1. open httpd.conf file in notepad , find line documentroot "c:/wamp/www". change documentroot "c:/wamp/www/default".
2. add following snippet below line:

namevirtualhost 127.0.0.1 <virtualhost 127.0.0.1>     servername localhost     documentroot 'c:/wamp/www' </virtualhost>  <virtualhost 127.0.0.1>     servername myproject.localhost     documentroot 'c:/wamp/www/myproject/public' </virtualhost> 

this create 2 new virtual hosts running on local ip. 1 work on domain localhost , serve files www/default folder, other work on domain myproject.localhost , serve files www/myproject/public folder.

  1. locate hosts file @ c:\windows\system32\drivers\etc , open in notepad. add following lines:
    127.0.0.1 localhost
    127.0.0.1 myproject.localhost
    add 2 domain mappings point traffic local ip wamp handle.

  2. now navigate www folder , create c:\wamp\www\default , c:\wamp\www\myproject. move laravel project \myproject folder ensuring public folder here well.

  3. finally restart wamp , should able go http://myproject.localhost , see laravel website.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -