We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30639
    • 22 Posts
    I have been searching the forum for an answer/solution but haven’t come up with one yet.

    If, in htaccess I:

    Redirect 301 /myoldpage.html http://www.mysite.com/mynewpage.html

    Results in 404 when attempting to access myoldpage.html rather than redirection.

    Modx appears to be attempting to determine if page exists but I’m wondering if there is a method to bypass this and be able to use htaccess for these type of redirects. I know that we can do header redirects but I’d like to delete the old page(s) to keep site structure clean. HTTPD config file can handle as well but not as convenient.

    This is a 0.9.5 site.

    Any thoughts?

    Thanks!
      • 30639
      • 22 Posts
      I take it everyone is as ignorant as I am? smiley
        • 33372
        • 1,611 Posts
        Well, I don’t know why regular redirects don’t work. I also discovered that the last time I tried to use them on a MODx site. But you can use a rewrite rule instead, and that will work.

        Just add

        RewriteRule myoldpage.html http://www.mysite.com/mynewpage.html [L,NC,R=301]

        right before

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 30639
          • 22 Posts
          I tried your suggestion and it works like a charm.

          Thank you very much for the response and the idea.