我基本上不了解正则表达式,但我需要一个正则表达式语句,它可以识别/
URL 中的任何内容。
基本上,我正在为某人开发一个网站,并且页面的 URL(课程的本地 URL)是(http://)localhost/sweettemptations/available-sweets
. 此页面充满了自定义帖子类型(这是一个 WordPress 网站),其 URL 为(http://)localhost/sweettemptations/sweets/sweet-name
.
我想要做的是将 URL 重定向(http://)localhost/sweettemptations/sweets
回(http://)localhost/sweettemptations/available-sweets
很容易做到的,但我还需要将任何类型的 sweet 重定向回(http://)localhost/sweettemptations/available-sweets
. 所以说我需要重定向(http://)localhost/sweettemptations/sweets/*
回(http://)localhost/sweettemptations/available-sweets
.
如果有人可以通过告诉我如何编写正确的正则表达式来匹配 URL 中 sweets/ 之后的所有内容来提供帮助,我们将不胜感激。