簡體   English   中英

當我在地址欄中按回車鍵時,Laravel 6 重定向到 https://www.example.com/index.php,地址為 www.example.com/profile?

[英]Laravel 6 redirecting to https://www.example.com/index.php when I press enter in the address bar with an address of www.example.com/profile?

我認為其他人也有同樣的問題。 我在使用 Inmotion Hosting 創建基本配置文件頁面的共享服務器上。 當我將光標放在地址欄中時,例如 url ' https://www.example.com/profile ' 並按 Enter Laravel 會顯示http://www.example.com/index.php這是一個空白頁。 這只發生在 Chrome 中。 我猜這可能與我的 .htaccess 文件有關? 下面是那個文件。 有任何想法嗎?

<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]

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^pollaclicks.com [NC] 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

此鏈接https://www.example.com/profile (將其視為示例)不存在,因此參考您的示例鏈接和規則將其重定向到http://www.example.com/index.php寫在你的 .htaccess 文件中。

在 .htaccess 文件中,這些規則造成了問題:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

這意味着如果指定名稱的文件不存在,或者目錄不存在,則繼續下面的重寫規則。

[L]標志導致 mod_rewrite 停止處理規則集

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM