Prestashop Webservice api url redirection

邮差的信 提交于 2021-01-27 14:12:03

问题


I'm trying to run a simple webservice to get a XML list of customers but, when getting http://www.myshopurl.com/api/customers, PS redirects to frontpage.

Mod_rewrite is on in apache (checked with phpinfo function). Think that .htaccess is well formed:

# ~~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
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

#Domain: www.mydomain.com
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/x-font-woff .woff
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
        Header add 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

Im using Prestashop 1.6.0.14 and PHP Version 5.5.9-1ubuntu4.19. Added new webservice and activated.

In other way, I've configured my 000-default.conf apache file as this:

<VirtualHost 127.0.0.1:8080>

    DocumentRoot /opt/prestashop_folder/
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    <Directory /opt/prestashop_folder>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    </Directory>
</VirtualHost>

Don't know if you need more data. Thanks for your time.


回答1:


Ok, sorry dudes, problem found.

Server has a NGinx and Apache working at same time. I though that apache was working with prestashop's front but I was wrong. Nginx is.

Nginx config had a rule that redirected all URL's to index.php. I've added new rule to /api/* and problem solved.



来源:https://stackoverflow.com/questions/43475602/prestashop-webservice-api-url-redirection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!