Xavier
Xavier

Reputation: 41

Prestashop 1.7 can"t access to api

I can't access to the api on my prestashop test-shop. Here what I did :

The webservices is active and a key is created :

screen copy of my admin

The rewrite mod is active on Apache :

Apache rewrite mod is ACTIVE

The htacess seems as it should be :

    # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: 192.168.1.20:8080
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

But anyway, it doesn't work :

it doesn't work....

The url is fine :

url is fine

I tried both way to connect :

localhost/api & http://mykey@localhost and both get me to 404.

Edit : Apache log (both error and access) don't tell anything about it... Edit : How can I check if urlRewrite is working well ?

Edit 2 : Well well well, the urlRewrite seems no to work at all. When I set it on, almost eveything doesn't work... ( can't get any product's page...)

Thanks for helping me. Xavier.

Upvotes: 1

Views: 1720

Answers (1)

Xavier
Xavier

Reputation: 41

Solved ! It was an Apache configuration issue.

<Directory /prestashop/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all <<<< all instead of none
    Order allow,deny
    allow from all
</Directory>

I have to change AllowOverride none by AllowOverride all. Thanks.

Upvotes: 3

Related Questions