5

I understand little about regular expressions, but I need to figure one out to use with the Redirection plugin which supports redirects with regular expressions. http://urbangiraffe.com/plugins/redirection/

What I need to do is redirect all urls in /oldsite/ to the domain root. That means any page in /oldsite/ like /oldsite/this-is-my-page.html, /oldsite/this-is-my-page-too.html, etc., needs to go to root via a regular expression.

I can't get a 301 redirect rule to work in .htaccess for some reason; there may be a restriction at the host, so I need to use this plugin.

It needs to be a regular expression in the format that the plugin understands. Some examples are in the docs for the plugin at that link above. The first field for a new redirection in the plugin takes the regular expression; the second field is the target URL.

This doesn't work:

Source: /oldsite/*
Target: http://mydomain.com

Nor does this:

Source: ^oldsite/(.*)
Target: http://mydomain.com

2 Answers 2

8

I modified it to redirect to a different URL but maintain the requested page:

Source: /(.*)
Target: http://mysite.com/$1
7

Got it to work with this:

Source: /oldsite/(.*)
Target:  http://mydomain.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.