We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered 301 Redirect

    • 40088
    • 708 Posts
    Revo 2.4.2
    Redirector 2.0.7

    So far every .htaccess redirect technique I've tried hasn't worked so now I'm trying the Redirector add-on.

    I need every child of directory1 to redirect to directory2.

    Here's what I'm using in Redirector:

    Pattern: ^directory1\/(.*)\/$

    Target: directory2/$1/

    Still no luck.

    This question has been answered by BobRay. See the first response.

      Todd
    • discuss.answer
      • 3749
      • 24,544 Posts
      I don't use Redirector, but this pattern says that the original URL must have a slash at the end of the line. Are you sure that's what you want?

      ^directory1\/(.*)\/$


      I'd try leaving off the \/.

      In fact, I'd try this (unless directory1's name is found in other URLs you don't want to redirect):

      Pattern: directory1
      Target: directory2

      .htaccess would be more efficient

      Try this in .htaccess

      RewriteCond %{REQUEST_URI} directory1
      RewriteRule directory1 directory2 [R=301,NC,L]
      
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting