【问题标题】:Laravel redirect from index.php and index.html to domainLaravel 从 index.php 和 index.html 重定向到域
【发布时间】:2021-01-26 19:27:38
【问题描述】:

我是初学者网络开发人员。 我有重定向的小问题。

我有这个过程:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
       Options -MultiViews -Indexes
    </IfModule>

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://domain.pl [R=301,L]

    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]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

一切正常。 现在我需要从https://domain.pl/index.phphttps://domain.pl.html 重定向到https://domain.pl

我使用 Laravel 8。

我该怎么做?

【问题讨论】:

标签: php laravel


【解决方案1】:

最简单的方法是

Route::get('/index.html', function(){ return redirect('http://domain/'); });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-19
    • 1970-01-01
    • 2010-10-27
    • 2016-12-26
    • 2021-09-21
    • 1970-01-01
    • 2019-04-02
    • 1970-01-01
    相关资源
    最近更新 更多