Forum Moderators: phranque
[edited by: not2easy at 5:53 am (utc) on Aug 14, 2017]
[edit reason] used 'example.com' for readability [/edit]
[edited by: phranque at 10:40 am (utc) on Aug 14, 2017]
[edit reason] exemplified urls for clarity (example.com isn't linked in this forum) [/edit]
RewriteCond %{HTTP_HOST} ^www.example.com/photos/$
RedirectMatch 301 ^photos/(.*)_(.*).jpg$ https://www.example.com/photos/$1/$1_$2.jpg
/photos/idpost_numberorder.jpg
photos/(\d+)_(.\d+)\.jpg
RewriteRule ^photos/(\d+)_(\d+)\.jpg$ https://www.example.com/photos/$1/$1_$2.jpg [R=301,L] RewriteRule ^photos/([0-9]+)_([0-9]+)\.jpg$ https://www.example.com/photos/$1/$1_$2.jpg [R=301,L] but it does not work either. Before -> https ://www.domain.com/photos/1171300_1.jpg
Before -> https ://www.domain.com/photos/1171300_2.jpg
...
Now -> https ://www.domain.com/photos/1171300/1171300_1.jpg
Now -> https ://www.domain.com/photos/1171300/1171300_2.jpg RewriteRule ^photos/([0-9]+)_([0-9]+)\.jpg$ https://www.domain.com/photos/$1/$1_$2.jpg [R=301,L] RewriteRule ^photos/(\d+)_(\d+)\.jpg$ https://www.domain.com/photos/$1/$1_$2.jpg [R=301,L]