【问题标题】:.Htaccess index php / html redirect to main page.htaccess index php / html 重定向到主页面
【发布时间】:2021-05-02 02:06:08
【问题描述】:

我有这个 .htaccess。 我想要:

  • 他会直接从www.domena.pl 到domena.pl(我已经完成了) 始终指向 https
  • 进入domena.pl/index php或index html后->重定向到https domena.pl

我该怎么做?

我的过程:

  RewriteEngine On
     # Redirect to non www
     RewriteCond% {HTTP_HOST} ^ www.domena.pl $ [NC]
     RewriteRule ^ (. *) $ Https://domena.pl/$1 [R = 301, L] 

【问题讨论】:

标签: laravel apache .htaccess


【解决方案1】:

使用 https 重定向到非 www:

RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

让所有路由都转到 index.php:

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

【讨论】:

    猜你喜欢
    • 2015-10-22
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 2016-03-29
    • 2013-01-31
    相关资源
    最近更新 更多