Answer the question
In order to leave comments, you need to log in
How to rewrite image url .htaccess?
Good morning dear hackers.
Never worked with .htaccess file
I want to convert links to images .
here are some links for example
https://oldsite.ru/mugs/Flagler/2018/2018-00001170.jpg
https://oldsite.ru/thumbs/Flagler/2018/2018-00001170.jpg
https://newsite.ru/Eachtime/Flagler/mugshots/2018/2018-00001170.jpg
https://newsite.ru/Eachtime/Flagler/thumbnails/2018/2018-00001170.jpg
Answer the question
In order to leave comments, you need to log in
Actually this is a pregmatch
RewriteCond %{HTTP_HOST} ^oldsite\.ru$
RewriteRule ^mugs/(.+[^/])/([0-9]{4,}/2018\-00001170\.jpg)$ https://newsite.ru/Eachtime/$1/mugshots/$2? [L,R=301]
(.+[^/])/
any number of characters from 1 to infinity In addition /
to /, in general, select everything up to the next slash. ()
[0-9]{4,}
from zero to nine 4 times, and already combine a fairly large part of the url with the second group. $1
and $2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question