Laravel 5 htaccess issue

2019-08-13 00:37发布

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条回答
倾城 Initia
2楼-- · 2019-08-13 01:24

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 :)

查看更多
登录 后发表回答