.htaccess 修改htaccess,将index.php重定向到文件夹/index.php

.htaccess 修改htaccess,将index.php重定向到文件夹/index.php,.htaccess,.htaccess,以下是我当前在.htaccess文件中的内容: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 当访问者访问网站时,我试图做到这一点:www.example.com而不是加载index.php我希望它加载文件夹/index.php 我在网上看到了类似这样的东西RewriteRule^index.php/folder[R=301],但这似乎不起作用 在保持.

以下是我当前在
.htaccess
文件中的内容:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
当访问者访问网站时,我试图做到这一点:
www.example.com
而不是加载
index.php
我希望它加载
文件夹/index.php

我在网上看到了类似这样的东西
RewriteRule^index.php/folder[R=301]
,但这似乎不起作用

在保持
.htaccess
当前的功能的同时,是否有办法做到这一点。

您可以使用:

RewriteEngine On

# http => https 
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=302]

# load folder/index.php for landing page
RewriteRule ^/?$ folder/index.php [L]