We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24629
    • 370 Posts
    Hi,
    I'm trying to set up a restful api alongside my Modx site following this tutorial (http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/developing-rest-servers)
    It states i need to put
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]

    in my .htaccess. But after doing so not only mysite.com/rest gives me the promised error but also the root of the website mysite.com/

    What do i need to do, to get the REST part in the .htaccess AND have the friendly URL part in the .htaccess to work

    thnx
    RDG

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

    • discuss.answer
      • 38850
      • 110 Posts
      It looks like this .htaccess file is meant to be IN the /rest folder itself, not as part of your main root .htaccess file. In other words, you need to have:

      /.htaccess
      /rest/.htaccess

      The root level one isn't changed from MODX default. The new one is placed in the /rest folder.

      This way, for any given URL that happens to start in the /rest folder, the server will override the root .htaccess in favor of the one inside /rest.

      Hope that does it!
        • 24629
        • 370 Posts
        Hi Vigilante,

        Thanks that was the solution. It works now.
        RDG