Answer the question
In order to leave comments, you need to log in
How to correctly compose a regular expression for a redirect?
The URL contains (can start, end or stand in the middle) 5dddd where each d is a digit from 0 to 9
How to write a rule so that such a URL is redirected to a URL like site.ru/?p=5dddd
Answer the question
In order to leave comments, you need to log in
.*([0-9]{5}).* from zero to nine 5 times any snala and any from the end, in brackets what will be in $1
site.ru/\?p=$1 - substitute what is in brackets
RewriteRule ^.*([0-9]{5}).*$ http://site.ru/\?p=$1 [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question