Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我想从根路径/index.php重定向到index.php?page=terms_Php_.htaccess - Fatal编程技术网

我想从根路径/index.php重定向到index.php?page=terms

我想从根路径/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(!

我正在.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(!isset($_GET["page"])){
      header("Location: index.php?page=terms");
    }

如果
?页面=
不存在,将重定向。这不需要任何
.htaccess
更改。

你能发布你的.htaccess的当前状态吗?我只在htaccess文件Redirect/index.php/index.php?page=term中添加了这一行。出于好奇(对于那些将来有同样问题的人),什么解决方案对你有效?