Title: Help with regular expression
Last modified: August 30, 2016

---

# Help with regular expression

 *  [sanguine](https://wordpress.org/support/users/sanguine/)
 * (@sanguine)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/)
 * I can successfully redirect some pages but not all. I don’t know how to write
   the expression.
 * target: [http://websitename/foldername/abc123.html](http://websitename/foldername/abc123.html)
   
   Destination: [http://websitename/foldername](http://websitename/foldername)
 * can help me with this?
 * [https://wordpress.org/plugins/redirection/](https://wordpress.org/plugins/redirection/)

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

 *  Thread Starter [sanguine](https://wordpress.org/support/users/sanguine/)
 * (@sanguine)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/#post-6608192)
 * continue….
    I wanted to have all files in the folder to be redirected to my destination.
 * what’s the expression?
 *  [jashaw](https://wordpress.org/support/users/jashaw/)
 * (@jashaw)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/#post-6608256)
 * I think this is what you’re asking for.
    target : /foldername/(.*) Destination:/
   foldername/$1
 *  Thread Starter [sanguine](https://wordpress.org/support/users/sanguine/)
 * (@sanguine)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/#post-6608315)
 * I tried, but cannot.
 * maybe I give the exact link:
 * target: [http://www.sanguineconsulting.com/WorkshopsNew/whatever123.html](http://www.sanguineconsulting.com/WorkshopsNew/whatever123.html)
 * Destination: [http://www.sanguineconsulting.com/workshops/](http://www.sanguineconsulting.com/workshops/)
 * could it be the file name whatever123.html. which have both characters and digit?
   can I still use (.*)
 * could it be the file name whatever123.html is still active when click, so it 
   won’t get redirected?
    Should I move this file to a different location first,
   is it will have ‘page not found’, then do the redirection?
 *  [jashaw](https://wordpress.org/support/users/jashaw/)
 * (@jashaw)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/#post-6608429)
 * .* will include any character.
 * Redirection doesn’t care about the existence of files. It will very happily redirect
   from an existing file to a non-existent one so make sure you take appropriate
   caution.
 * Make sure you checked the regex option or it will be looking for an exact match.
 * You might try recreating your rules, [https://wordpress.org/support/topic/working-redirections-just-stop-working?replies=7](https://wordpress.org/support/topic/working-redirections-just-stop-working?replies=7)
 * If you are trying to redirect subfolders, see this link, [https://wordpress.org/support/topic/plugin-redirection-wildcard-expression?replies=7</a. Sometimes this plugin does not follow strict regex rules. ](https://wordpress.org/support/topic/plugin-redirection-wildcard-expression?replies=7)
 * You can play around with regex here, [regexpal.com](http://regexpal.com).
 * You can also see find documentation here, [http://urbangiraffe.com/plugins/redirection/](http://urbangiraffe.com/plugins/redirection/)

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

The topic ‘Help with regular expression’ 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: [jashaw](https://wordpress.org/support/users/jashaw/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/help-with-regular-expression/#post-6608429)
 * Status: not resolved