Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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
拆下';php';在不删除.htaccess中的参数的情况下从url_.htaccess_Redirect_Indexing_Permanent - Fatal编程技术网

拆下';php';在不删除.htaccess中的参数的情况下从url

拆下';php';在不删除.htaccess中的参数的情况下从url,.htaccess,redirect,indexing,permanent,.htaccess,Redirect,Indexing,Permanent,我有一个url重定向的条件,比如 www.domain.com/something/anotherthing/index.php 我需要上面的url重定向到 www.domain.com/something/anotherthing/ 如果我去 www.domain.com/index.php/something/anotherthing 我想重定向到 www.domain.com/something/anotherthing 我对此有一个重定向访问规则 RewriteCond%{THE_REQ

我有一个url重定向的条件,比如

www.domain.com/something/anotherthing/index.php

我需要上面的url重定向到

www.domain.com/something/anotherthing/

如果我去

www.domain.com/index.php/something/anotherthing

我想重定向到

www.domain.com/something/anotherthing

我对此有一个重定向访问规则

RewriteCond%{THE_REQUEST}^[A-Z]{3,}\s(.*)/index.php$1[NC]

重写规则^/%1$1[R=301,L]

但这适用于第一个条件,但在后一个条件中,它将我重定向到根页面。任何人都可以在这个重定向中提供帮助


提前谢谢。

试试这样的方法:

RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index.php/?([^\ \?]*) [NC]
RewriteRule ^ %1/%2 [R=301,L]
它应该处理
/index.php
的任何位置