Creating htaccess File for Laravel Shared Host

Created At: 2023-02-13 01:22:50 Updated At: 2023-02-13 01:45:23

Let's learn how to edit .htaccess file for shared host Laravel. If you host your Laravel application you may see public folder in your url. But you don't wanna show public folder.

But shared is configured for every framework. You need to modify your .htaccess file.

To remove public folder from your url just add the below two lines in your .htaccess file.

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

With this above line you will remove public folder name from your url. 

Without the above code in your .htaccess file, your url may look like this

www.example.com/public/tutorials/

With the above code now it will look like. Because the above code removes public folder name from the url.

www.example.com/tutorials/

 

Comment

Add Reviews