[英]I want to redirect from root path /index.php to index.php?page=terms
我正在 .htaccess 文件中进行更改以将根路径 (/) 更改为 index.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
更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.