使用cpanel在服务器上设置laravel项目

我正在尝试将laravel项目设置为该面板的主页,出于隐私方面的考虑,我将模糊网站名称等。我已重定向到这样的目录

使用cpanel在服务器上设置laravel项目

当我单击目录链接时,我被发送到该项目,但遇到这些错误

  

拒绝应用“ http://page_example.com/css/app.css?id=4513b702e5714c4239c0”中的样式,因为它的MIME类型(“ text / html”)不是受支持的样式表MIME类型,并且启用了严格的MIME检查。

如果我尝试进入没有Enum.filter(s,fn x -> if(x != "") do x end end) 的页面,就会被重定向到没有/ex_server/public的{​​{1}},并且被禁止使用403。

我认为重定向甚至都没有用,因为在public_html文件的index.php文件中,我有此功能,如果仅保留前两个默认代码块,则可以重定向到默认的a2hosting页面,但是如果我先注释掉第一件事,而只保留手动重定向,那么我的确会重定向到该页面。

page_example.com/ex_server

如何解决这些错误并使重定向正常工作?

yjyhp5211314 回答:使用cpanel在服务器上设置laravel项目

您可以尝试添加此文件

  

.htaccess文件到public_html文件夹

RewriteEngine on 

# for example.com rewrite landing page to subdirectory/index.php
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^/?$ subdirectory/index.php[L]

# for example.com rewrite all other URIs to subdirectory/uri
# (?!subdirectory/) is a negative lookahead that stops rewrite then uri 
# already starts with /subdirectory/
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^(?!subdirectory/)(.+)$ subdirectory/$1 [L,NC]

将子目录更改为home,将示例更改为您的域名。

本文链接:https://www.f2er.com/3099733.html

大家都在问