Answer the question
In order to leave comments, you need to log in
How to make a regular expression for redirect?
now urls are built according to the pattern
/category1/number(numbers only)/post
How to redirect from a url with a number to a url without a number? The problem is that categories can be with subcategories
i.e. there are addresses of the form
/ka1/number/post -> /ka1/post
and there are
/ka1/cat2/number/post -> /ka1/cat2/post
and so on
Answer the question
In order to leave comments, you need to log in
RewriteRule ^\/([\w\d]+)\/([\w\d]+)\/([\w\d]+)$ /$1/$3
RewriteRule ^\/([\w\d]+)\/([\w\d]+)\/([\w\d]+)\/([\w\d]+)$ /$1/$2/$4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question