0

Currently I am using Shared Web Hosting, and uploaded my Laravel project (developed in Laravel 5.1), but I have to type to public with domain name. eg: abc.com/public/blogpage

My Hosting seller not mapping my domain to laravel public folder so Its mapped to public_html folder.

Is there any way available to remove public word from URL? I tried to keep my files in public_html folder and moved public folder out of `public_html' folder, but no luck,

Kindly guideme

Qazi
  • 5,015
  • 8
  • 42
  • 62
  • Possible duplicate of [Laravel 5 - Remove public from URL](http://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url) – baikho Sep 10 '16 at 22:03

1 Answers1

0

This is recommended for those, who are using shared hosting and not able to remove public from route.


the easiest and simplest way to remove public keyword from Laravel routes is follow these steps.

  1. Put all your files and folder except Public folder, outside public_html folder, I mean Root folder of your site.

    enter image description here

  2. Then grab all files and folder from Public folder and put them into public_html folder. enter image description here

once done with this, then create a file (name it, paths.php) into your bootstrap folder (Laravel folder exists in your root folder) copy below code into paths.php file

<?php 

return array(

    'app' => __DIR__.'/../app',
    'public' => __DIR__.'/../public_html',
    'base' => __DIR__.'/..',
    'storage' => __DIR__.'/../app/storage',
);

Now access your website without public word in URL, if you see error, then try to Hard reload (Ctrl + 5) it. Thats it


Note: This is not the recommended way, in shared hosting, better to ask your Hosting Manager/ re-seller to change your domain mapping on public_html/public instead public_html. and if you are using dedicated, cloud hosting then you can change it by yourself in your Virtual Host file.

Qazi
  • 5,015
  • 8
  • 42
  • 62