Jump to content

Community

Htacces for Rest & OAuth access


Go to solution Solved by phreezie,

Recommended Posts

Hi,

I'm trying to access the Rest & OAuth menu in the ACP, but it's asking me to put a htacces file in the api directory.

I did it and renamed it .htaccess as asked but I still get the screen asking me to download it and put it in the api directory.

I have no idea how to resolve this.

Best regards

The problem might be that I use nginx which is not supporting htaccess files.

Can I have some help to convert what's inside this file to nginx config ? I'm pretty new into nginx and that would help me a lot :

<IfModule mod_setenvif.c>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

 

Edited by Gaetan WELTZER
Link to comment
Share on other sites

  • 1 month later...
  • Solution

This works for me when developing locally:

location / {

    location /api/ {
        if (!-e $request_filename){
              rewrite ^/api/(.*)$ /api/index.php;
        }
    }

    if (!-e $request_filename){
         rewrite ^(.*)$ /index.php;
    }

    try_files $uri $uri/ =404;
}

location ~ \.php$ {
    include fastcgi-php.conf;
    fastcgi_pass   127.0.0.1:9000;
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy