我正在 .htaccess 文件中进行更改以将根路径 (/( 更改为索引.php?page=terms
重定向/index.php/index.php?page=terms
但它显示错误重定向次数太多
您是否尝试过更改索引页的名称?例如,从index.php
重定向到home.php?page=terms
该页面可能会重定向所有index.php
页面(包括index.php?page=terms
(,因为它毕竟是同一个页面,只是 URL 中有一点 GET 信息。
或者,您可能只想使用以下内容:
if(!isset($_GET["page"])){
header("Location: index.php?page=terms");
}
如果?page=
不存在,这将重定向。这不需要任何.htaccess
更改。