[英]how to redirect to the public folder
When filling on hosting, I faced the problem that you can not select the start folder of the opening.在主机上填写时,我遇到的问题是您无法打开 select 的启动文件夹。 When opening a link юhttps://my-domen/ this opens打开链接时 юhttps://my-domen/ 这将打开
to get to the site, enter /public how to make sure that when you open the site, the public folder is immediately opened on the hosting so you can not configure it.要访问该站点,请输入 /public 如何确保当您打开站点时,公用文件夹会立即在主机上打开,因此您无法对其进行配置。 Can I use htaccess or something else?我可以使用 htaccess 或其他东西吗? If this helps then the laravel files are a clean project如果这有帮助,那么 laravel 文件是一个干净的项目
htaccess htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
In your root folder use this .htaccess
:在您的根文件夹中使用此.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
In the public folder use the new clean laravel .htaccess
file在公用文件夹中使用新的干净 laravel .htaccess
文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.