We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52128
    • 29 Posts
    Hi I used to use htaccess but since i moved to Modx cloud, i was wondering if you could help me.

    I would like to redirect /packing-list to /what-to-bring-and-what-to-wear


    I have tried the code below for the "Adjust Web rules" but it didn't work.

    # redirect /packing-list to /what-to-bring-and-what-to-wear
    rewrite ^/packing-list\ /what-to-bring-and-what-to-wear permanent;
    
    location / {
        try_files $uri $uri/ @modx-rewrite;
    }


    Appreciate any help

    Thanks

    Magz

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

      • 22840
      • 1,572 Posts
      Try the Following:

      # redirect /packing-list to /what-to-bring-and-what-to-wear
      rewrite ^/packing-list /what-to-bring-and-what-to-wear permanent;
       
      location / {
          try_files $uri $uri/ @modx-rewrite;
      }
        • 3749
        • 24,544 Posts
        Typically, pagetitles can have have spaces in them but aliases don't.

        You might have to change the alias to:

        what-to-bring-and-what-to-wear-permanent

          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
          • 22840
          • 1,572 Posts
          Quote from: BobRay at May 12, 2016, 10:43 PM
          Typically, pagetitles can have have spaces in them but aliases don't.

          You might have to change the alias to:

          what-to-bring-and-what-to-wear-permanent


          I think permanent is the redirect rule not part of the URL
            • 52128
            • 29 Posts
            Hi Everyone,

            Thank you for your replies,

            Tt still didn't work. It giving me an error:

            There was an error with your rewrite rules. Please check the syntax and make sure you've entered them correctly. Errors: nginx: [emerg] unknown directive "/packing-list" in 28359.temp.conf:92 nginx: configuration file 28359.temp.conf test failed

            Do you know what this means?

            Thanks

            Magz
            • discuss.answer
              • 22840
              • 1,572 Posts
              Not sure then as I don't use nginx as a rule, might get a better response posting it in the Modx Cloud section https://forums.modx.com/board/278/modx-cloud
                • 52128
                • 29 Posts
                Quote from: paulp at May 13, 2016, 09:19 AM
                Not sure then as I don't use nginx as a rule, might get a better response posting it in the Modx Cloud section https://forums.modx.com/board/278/modx-cloud

                Thanks, i will contact them now

                Magz