neha menahil
neha menahil

Reputation: 11

Is there any way to remove this public from the URL?

I am using laragon server for php 7.2 laravel. I have tried a lot to remove public keyword from my url http://localhost/myLaravel/public/ by its normal method of copying .htaccess folder in my laravel project directory as well as by copying and renaming server file to index.php. But it didn't work. whenever i write this url: http://localhost/myLaravel/ it give me following error: Forbidden You don't have permission to access /myLaravel/ on this server.

Any solution?

Upvotes: 0

Views: 1350

Answers (2)

Rhl singh
Rhl singh

Reputation: 88

You can use this htaccess code in laravel root directory.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Upvotes: 0

Robo Robok
Robo Robok

Reputation: 22673

Laravel app is not meant to be accessible in a subdirectory by default. You can do one of the following:

Upvotes: 1

Related Questions