Laravel 5 htaccess issue

2019-08-13 01:32发布

问题:

I have a Laravel5 project which is hosted on my server in a subfolder. I want access the project by www.example.com/edu I failed. I add a .htaccess file in root with

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_URI} !^public

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

</IfModule>

But doesnot work, when I go to www.example.com/edu/public it works fine. How to remove public from url. Thank you.

回答1:

Try this Rule:-

<IfModule mod_rewrite.c>
    RewriteEngine On

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

This link1 and link2 helps you.

Hope it will work for you :)