New answers tagged


I think this is what you are looking for if (preg_match('@^/((?!blog|tag)[^/]+)/(?:page/)?\d+@', $_SERVER['REQUEST_URI'], $m)) { wp_redirect("/$m[1]", 301); } The regexp uses lookahead to make sure that the first match isn't blog or tag. The '[^/]+' part matches anything that isn't a forward slash (/). (?:page/)? - Makes an optional match against '...

Top 50 recent answers are included