apache - Prestashop 1.7 无法访问 api
问题描述
我无法访问我的 prestashop 测试商店上的 api。这是我所做的:
网络服务处于活动状态并创建了一个密钥:
rewrite mod 在 Apache 上处于活动状态:
htacess 看起来应该是这样的:
# ~~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
但无论如何,它不起作用:
网址很好:
我尝试了两种连接方式:
localhost/api 和 http://mykey@localhost 都让我进入 404。
编辑:Apache 日志(错误和访问)没有说明任何内容... 编辑:如何检查 urlRewrite 是否运行良好?
编辑 2:好吧好吧, urlRewrite 似乎根本不起作用。当我设置它时,几乎所有东西都不起作用......(无法获得任何产品的页面......)
谢谢你帮助我。泽维尔。
解决方案
解决了 !这是一个 Apache 配置问题。
<Directory /prestashop/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all <<<< all instead of none
Order allow,deny
allow from all
</Directory>
我必须通过 AllowOverride all 更改 AllowOverride none。谢谢。
推荐阅读
- javascript - a.prototype.bc() 如何获取 a 的实例?
- c++ - 具有多级指针的 WriteProcessMemory
- export - 有没有办法将整个笔记本导出到不同的部分
- android - Android 在 Recyclerview Adapter 中使用 getSupportFragmentManager
- javascript - 使用 button.class 提交 ajax
- regex - 在vscode中使用正则表达式删除特定位置的字符
- python-3.x - Lambda 应用于 Pandas 值,取行前后的平均值
- php - 如何每 10 分钟错开一次循环
- php - 正则表达式匹配相同的单词
- http - http.Client 在编译为 wasm 的 Go 中不起作用