regex重定向htaccess中的子目录,但DONT重定向父目录索引本身

时间:2017-12-21 05:38:03

标签: regex .htaccess redirect

您好我试图301重定向父目录的任何和所有子目录,但没有重定向父目录索引本身

这是我目前拥有的

RewriteEngine On
RewriteRule ^parent/(.*) /newtoplevel/parent/$1 [R=301,NC,L]

上面的代码似乎工作正常,但不幸的是,我的使用它也将原始父索引重定向到新的。例如,如果我加载http://example.com/parent/,它会重定向到http://example.com/newtoplevel/parent/ ,这不是我需要的 ......

我只希望各种/ parent /子目录/重定向到/ newtoplevel / parent /子目录

确保/parent/index.html(http://example.com/parent/)不重定向

1 个答案:

答案 0 :(得分:0)

如果您只想重定向int main() { // read as gray and threshold Mat gray, threshed, dist; gray = imread("img01.png", 0); threshold(gray, threshed, 100, 255, THRESH_BINARY); imshow("threshed", threshed); //distanceTransform distanceTransform(threshed, dist, DIST_L2, 3); // normalize for display Mat dst; normalize(dist, dst, 255, 0, NORM_MINMAX,CV_8UC1); imshow("dst", dst); waitKey(); return 0; } 的子目录(parent/.../)(并按原样保留子树),那么您应该使用以下正则表达式:

parent

regex101 https://regex101.com/r/gv6ZUf/4

上进行测试
相关问题