How to remove public from url in laravel?

How to remove public from url in laravel?

There are two ways:

  • (1) Rename File and move htaccess file
  • (2)create htaccess File.
  • Rename File and move htaccess file from public

    Rename the "server.php" file in root directory to index.php and Copy the ".htaccess" file in public directory and paste on root directory.

    Create htaccess File

    File name : index.php

    Create the .htaccess file on root directory and paste below following code in this file.

    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]

    Change Assest Url

    File name : app.php

    if you are not working of assest Url, Then go to config folder and open the app.php file. You can change assest Url in this file. like as “http://localhost/your-Project-Folder-Name/public/”

    How to call assets from public folder.

    File name : config/app.php

    //'asset_url' => env('ASSET_URL', null),

    'asset_url' => env('ASSET_URL', 'http://localhost/grocery/public'),


    Note :- your all assets in assets folder in public directory.



    {{asset('assets/css/styles.css')}}





    Previous Next


    Trending Tutorials




    Review & Rating

    0.0 / 5

    0 Review

    5
    (0)

    4
    (0)

    3
    (0)

    2
    (0)

    1
    (0)

    Write Review Here


    Ittutorial