Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a classic Larevel 5 project structure and I need to redirect all requests to public/.

I am on a classic hosting environment so public/ is a subfolder of my document root.

I shall imagine it can be done via .htaccess but I still need to figure out how. Anyone can help?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
691 views
Welcome To Ask or Share your Answers For Others

1 Answer

There are two solutions:

1. Using .htaccess with mod_rewrite

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

2. You can add a index.php file containing the following code and put it under your root Laravel folder (public_html folder).

<?php
header('Location: public/');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...