We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31640
    • 100 Posts
    I followed the guide for setting up the Restful api in modx 2.3.2 descibed in the following manual:
    http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/developing-rest-servers

    But i have already a website set up with friendly url's enabled.
    So the htaccess file contains
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    


    But when i add the needed tags for the rest api
    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]
    


    my site stops working...

    Can somebody help me and provide me with a working htaccess file so that my friendly url's keep working but my www.website.com/rest/ give the rest results

    Much appreciated because i am stuck on this part for a whole day sad
      • 14784
      • 16 Posts
      If your REST API is going to be on the same domain/subdomain as your regular site, you'll want to access your API through a subfolder.

      Your users would access your API with a URL like "website.com/rest/items/1"

      To do this you'll want to create an .htaccess file in your /rest folder and change it to be
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-s
      RewriteRule ^(.*)$ index.php?_rest=$1 [QSA,NC,L]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^(.*)$ index.php [QSA,NC,L]