我想从根路径/index.php重定向到index.php?page=terms
我正在.htaccess文件中进行更改,以将根路径(/)更改为index.php?page=terms 重定向/index.php/index.php?页面=术语我想从根路径/index.php重定向到index.php?page=terms,php,.htaccess,Php,.htaccess,我正在.htaccess文件中进行更改,以将根路径(/)更改为index.php?page=terms 重定向/index.php/index.php?页面=术语 但是它显示错误重定向的次数太多了您是否尝试过更改索引页的名称?例如,从index.php重定向到home.php?page=terms 页面可能会重定向所有index.php页面(包括index.php?page=terms),因为毕竟它是同一个页面,URL中只有一点点GET info 或者,您可能只想使用以下内容: if(!
但是它显示错误重定向的次数太多了您是否尝试过更改索引页的名称?例如,从
index.php
重定向到home.php?page=terms
页面可能会重定向所有index.php
页面(包括index.php?page=terms
),因为毕竟它是同一个页面,URL中只有一点点GET info
或者,您可能只想使用以下内容:
if(!isset($_GET["page"])){
header("Location: index.php?page=terms");
}
如果
?页面=
不存在,将重定向。这不需要任何.htaccess
更改。你能发布你的.htaccess的当前状态吗?我只在htaccess文件Redirect/index.php/index.php?page=term中添加了这一行。出于好奇(对于那些将来有同样问题的人),什么解决方案对你有效?