![](/img/trans.png)
[英]how can i use laravel website in CWP (Centos-Web-Panel). without public folder in url?
[英]I need laravel website to open in https without public in url, how can I do it?
我在 Laravel 上创建了网站,因此该网站在 www.domain.com/public/ 下打开。 所以我在这里搜索了我的答案,发现这对我有用,在我添加此代码后,页面在 www.domain.com 上打开,而没有将 public 添加到 URL:
访问:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
但是现在我安装了 SSL,我想强制它在 https 链接上打开一个页面,但我不知道为什么它不会。 我将 .evn 文件中的 APP URL 设置为 https 链接,并将此代码添加到 htacces 文件中:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ https://domain/$1 [L]
</IfModule>
现在,当我尝试删除 public 并将代码设置为:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ https://domain/$1 [L]
</IfModule>
它根本不会打开我的网站。 请如果有人知道解决这个问题,我将非常感谢,最良好的祝愿!
这个怎么样?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://% {HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.