Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/21.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
Regex mod rewrite正则表达式问题_Regex_Mod Rewrite - Fatal编程技术网

Regex mod rewrite正则表达式问题

Regex mod rewrite正则表达式问题,regex,mod-rewrite,Regex,Mod Rewrite,为什么这个重写不正确?在我看来,它应该像预期的那样工作 重写规则^/series/([^/]*)$index.php?名称=$1 所以localhost/series/xxxx 应该重定向到localhost/index.php?name=xxx您正在附加到查询字符串。这意味着您必须将QSA标志附加到规则(查询字符串附加): 另外,正如@FelipeAlamedaA提到的,如果这是在.htaccess中,您应该删除首字母/删除第一个斜杠/series..,然后再试一次。@FelipeAlamed

为什么这个重写不正确?在我看来,它应该像预期的那样工作

重写规则^/series/([^/]*)$index.php?名称=$1

所以localhost/series/xxxx
应该重定向到localhost/index.php?name=xxx

您正在附加到查询字符串。这意味着您必须将
QSA
标志附加到规则(查询字符串附加):


另外,正如@FelipeAlamedaA提到的,如果这是在
.htaccess
中,您应该删除首字母
/

删除第一个斜杠
/series..
,然后再试一次。@FelipeAlamedaA如果这是在
.htaccess
中,那么是的——如果这是一个“真正的”站点配置,则不是。
RewriteRule ^/series/([^/]*)$ index.php?name=$1 [QSA]