Laravel共享主机.htaccess [英] Laravel Shared Hosting .htaccess
本文介绍了Laravel共享主机.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Laravel项目部署到共享托管上,我已经设法完成了大部分艰苦的工作,但是在没有禁止的问题的情况下,我无法剥离/public目录.
I am trying to deploy a Laravel project onto a share hosting, I've managed to get most of the hard work done but I cannot strip off the /public directory without a Forbidden issue.
该网站正常工作并显示这些链接的相同页面
The website works and shows same pages for these links
- www.mywebsite.com/test/index.php
- www.mywebsite.com/test/public/
但是没有/index.php它返回->
But without the /index.php It returns ->
Forbidden
You don't have permission to access /test/ on this server.
当前,我的.htaccess如下所示.
Currently my .htaccess looks like the following.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
</IfModule>
有什么想法吗?
推荐答案
在 test/.htaccess
中尝试此规则:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>
这篇关于Laravel共享主机.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文