1

I have seen many questions like this, which solve in removing public in cases like example.com/public. But in my case i have example.com/cases/public. How to deal with this type of situatations.

mask man
  • 351
  • 2
  • 11
  • Does your `DocumentRoot` (apache) or `root` (nginx) point to yourlaravelproject/public? – Ivanka Todorova Aug 24 '15 at 08:44
  • i don't know much about documentroot fir what i see here http://httpd.apache.org/docs/2.2/mod/core.html#documentroot, my document root is /project/cases – mask man Aug 24 '15 at 08:49
  • It should point to `/project/cases/public`. – Ivanka Todorova Aug 24 '15 at 08:49
  • how to achieve that? – mask man Aug 24 '15 at 08:51
  • Are you working on a localhost or on a remote server? If on localhost are you using some package as XAMPP, EasyPHP, MAMP (depending on your OS)? If on a remote server - is it a shared hosting or a dedicated server (VPS)? – Ivanka Todorova Aug 24 '15 at 08:58
  • working on localhost using lamp – mask man Aug 24 '15 at 09:00
  • Then, follow this tutorial: It will help you setup a virtual host and configure it for Laravel or if you already have a VirtualHost for this project edit the configuration to fix your problem. http://laravel-recipes.com/recipes/25/creating-an-apache-virtualhost – Ivanka Todorova Aug 24 '15 at 09:04
  • Possible duplicate of [Laravel 5 - Remove public from URL](http://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url) – Samay Nov 19 '16 at 10:21

2 Answers2

1

Follow this steps to remove the public from url

  1. Copy .htaccess file from /public directory to Laravel/project root folder.
  2. Rename the server.php in the Laravel/project root folder to index.php.

Cheers your will be good now.

Please Note: It is tested for Laravel 4.2, Laravel 5.1, Laravel 5.2, Laravel 5.3.

I think this is the easiest way remove public.

Rana Ghosh
  • 4,514
  • 5
  • 23
  • 40
0

If you want to remove cases/public from url than you can use this

RewriteBase / RewriteRule ^cases/public http://example.com/ [R=301,L]

Remove direction R=301 in above line to make it internal redirection

nav
  • 151
  • 1
  • 5