![](/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.