2017-04-18 74 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/*並解決了問題。