Title: Problem with RegEx
Last modified: August 30, 2016

---

# Problem with RegEx

 *  [centurypixel](https://wordpress.org/support/users/centurypixel/)
 * (@centurypixel)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-with-regex/)
 * I am trying to redirect all URLs that has the “product-category” in the path,
   to a page, but the extension is not picking up neither of the below regular expressions:
 *     ```
       ^.*?product-category.*?$
   
       (http.*?product-category.*?$)|(ftp.*?product-category.*?$)
       ```
   
 * [https://wordpress.org/plugins/redirection/](https://wordpress.org/plugins/redirection/)

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

 *  [Gabe462](https://wordpress.org/support/users/gabe462/)
 * (@gabe462)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-with-regex/#post-6425001)
 * try
    from: (?i)\/product-category\/(.*)
 * to:
    /destination-page
 * The (?.i) makes the test string case-insensitive. Are you also trying to catch
   requests via FTP? I’m pretty sure that’s beyond the scope of what Redirection
   or WordPress can handle. You don’t need to specify http or the hostname in general,
   and can just focus on the path.
 *  Thread Starter [centurypixel](https://wordpress.org/support/users/centurypixel/)
 * (@centurypixel)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-with-regex/#post-6425002)
 * Thank you Gabe462. However, it didn’t work me. I have made sure to select regex
   option too. Maybe it has to do with my server. Who knows.
 * I will try to find a way to do it using htaccess
 * Thanks again.
 *  [Gabe462](https://wordpress.org/support/users/gabe462/)
 * (@gabe462)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-with-regex/#post-6425003)
 * We can try a bit more, it should work- I’m pretty sure regex is interpreted via
   PHP, so there shouldn’t be anything that can break it on your server.
 * What happened when you went to one of the /product-category/urls ? Just no redirect?
   What about just going to /product-category/ ?
 * Here’s that regex demonstrated in a great learning tool: [https://regex101.com/r/sP0sD6/4](https://regex101.com/r/sP0sD6/4)
 *  Thread Starter [centurypixel](https://wordpress.org/support/users/centurypixel/)
 * (@centurypixel)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/problem-with-regex/#post-6425018)
 * Hello Gabe462,
    It is working now. I am not sure how, but it is working. So no
   worries. Thank you!

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

The topic ‘Problem with RegEx’ 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/)

## Tags

 * [regex](https://wordpress.org/support/topic-tag/regex/)

 * 4 replies
 * 2 participants
 * Last reply from: [centurypixel](https://wordpress.org/support/users/centurypixel/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/problem-with-regex/#post-6425018)
 * Status: not resolved