2017-04-18 113 views
2

我试图运行一个简单的web服务来获得客户的XML列表,但是,当获得http://www.myshopurl.com/api/customers时,PS重定向到FrontPage。Prestashop Webservice API重定向

mod_rewrite的是对apache的(具有的phpinfo函数选中)。认为的.htaccess很好地形成:使用的Prestashop 1.6.0.14和PHP版本5.5.9-1ubuntu4.19

# ~~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 

林。增加了新的webservice并激活。

在其他的方式,我已经配置了我的000-default.conf apache的文件,因为这:

<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> 

不知道,如果你需要更多的数据。谢谢你的时间。

回答

0

好了,对不起帅哥,发现问题。

服务器有一个nginx的和Apache在同时工作。我虽然阿帕奇与PrestaShop的前工作,但我错了。 Nginx是。

Nginx的配置了重定向的URL所有的到index.php的规则。我已将新规则添加到/ api/*并解决了问题。