Title: [Plugin: Redirection] Replace path only when combined with certain subfolder
Last modified: August 21, 2016

---

# [Plugin: Redirection] Replace path only when combined with certain subfolder

 *  Resolved [julielerman](https://wordpress.org/support/users/julielerman/)
 * (@julielerman)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/)
 * I’ve been trying to achieve this rediretion after moving a blog.
    The old blog
   was in a physical path called blog and had many images in a directory path that
   begins with blog/files/….
 * So I’m trying to set uop redirect to replace occurrences of blog/files/… with
   just files/…
 * It is successfully redirecting the desired files but is ALSO redirecting anything
   else that starts with /blog
 * e.g. mydomain.com/blog can’t be reached.
 * I’m using this as my source:
    /blog/files/(.*)
 * And…oh…looks like in my experiments I lost the target that was at least redirecting
   the files properly.
 * So the desired source could be
 * blog/files/a.png
    blog/files/folder/a.png
 * etc.
 * I just want it ONLY to strip out “blog/” when it is followed by files.
 * Thanks for any help.
 * [http://wordpress.org/plugins/redirection/](http://wordpress.org/plugins/redirection/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Chris](https://wordpress.org/support/users/lamordnt/)
 * (@lamordnt)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/#post-4480288)
 * I am also trying to figure out how to do this.
 *  Thread Starter [julielerman](https://wordpress.org/support/users/julielerman/)
 * (@julielerman)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/#post-4480289)
 * I did manage to finally get it working. it was a lot of trial and error though
   this looks so simple!
 * Source url: blog/files(.*)
    Regex is checked Target url: files/$1
 * hope it helps!
 *  [Chris](https://wordpress.org/support/users/lamordnt/)
 * (@lamordnt)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/#post-4480290)
 * YES! Thank you so much for sharing the solution, was exactly what I was looking
   for.
 *  Thread Starter [julielerman](https://wordpress.org/support/users/julielerman/)
 * (@julielerman)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/#post-4480291)
 * yay! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Redirection] Replace path only when combined with certain subfolder’
is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [julielerman](https://wordpress.org/support/users/julielerman/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/plugin-redirection-replace-path-only-when-combined-with-certain-subfolder/#post-4480291)
 * Status: resolved