open-admin icon indicating copy to clipboard operation
open-admin copied to clipboard

How can I remove /public from URL

Open optiktr opened this issue 1 year ago • 3 comments

What is the method that will not cause any problems in receiving updates? If I take out the public folder I feel like I've corrupted the root.

optiktr avatar Nov 28 '23 13:11 optiktr

???

optiktr avatar Dec 06 '23 06:12 optiktr

But why take out the public folder? I think .htaccess automatically adds /public to URL. Could you add some more context to it? I feel this seems to be a generic Laravel question and not package based.

SachinBahukhandi avatar Dec 10 '23 07:12 SachinBahukhandi

create a .htaccess file on laravel root folder with the following contents:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^$ public/index.php [L]
    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>

Now you can access the urls without /public prefix.

nkmswot avatar Dec 14 '23 05:12 nkmswot