Hi,
Easiest way is to create a .htaccess file in your laravel root directory, then add this into the file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Better option (recommended for production environments), is to set you document root for apache (xampp) to the public folder, and not the laravel folder.
Source: https://coderwall.com/p/erbaig Source2: Personal Experience
Change your document root in your apache config from "your/path/to/laravel" to "your/path/to/laravel/public"
thepsion5 said:
Change your document root in your apache config from "your/path/to/laravel" to "your/path/to/laravel/public"
AGREE
supernoctem said:
Hi,
Easiest way is to create a .htaccess file in your laravel root directory, then add this into the file:
RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]
Better option (recommended for production environments), is to set you document root for apache (xampp) to the public folder, and not the laravel folder.
Source: https://coderwall.com/p/erbaig Source2: Personal Experience
Hi! on Xamp I'm using virtual host and on my shared host I did it like this : [http://driesvints.com/blog/laravel-4-on-a-shared-host]
thepsion5 said:
Change your document root in your apache config from "your/path/to/laravel" to "your/path/to/laravel/public"
This is the best and most correct way to accomplish this. It is the recommended configuration from the Laraval install guide.
Thanks guys,
This is great on local host. On my on line server I dont have accesst o apache config.
What should I do there?
Thanks
So I decided to set up the virtual host. Things that I did:
/Applications/XAMPP/etc/httpd.conf
Include etc/extra/httpd-vhosts.conf
/Applications/XAMPP/etc/extra/httpd-vhosts.conf
<VirtualHost *:80>ServerAdmin [email protected]
DocumentRoot "/Applications/XAMPP/htdocs/ben/public"
ServerName "Application/XAMPP/htdocs/ben"
ErrorLog "Application/XAMPP/htdocs/ben/error_logs_server"
</VirtualHost>
When I go to h t t p://localhost/ben I see the list of directories in that folder (including public).
I have also created the hosts file in etc and it contains
/Applications/XAMPP/htdocs/ben/public /Applications/XAMPP/htdocs/ben
What would be the next step to fix this?
Thanks
Hi, I have tried this and i am also sharing way what i used for remove public from url Here
If you can't set the root folder on a server, you can always do something like this:
That way you can use the existing document root without getting a /public/ folder (or keeping your /app folder accessible from the web), and no need to change any server settings. Disclaimer: I didn't try it myself, but it should work :)
Hope that helps.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community