php - Prestashop - 模块中的 index.php?controller=404
问题描述
我已经在 Prestashop Addons(PrestaShop 1.6)中发布了模块,它在我的本地环境以及生产环境中都可以正常工作,并且已经有几个客户安装了它。
我正在使用模块前端控制器在模块内部导航(在管理面板端使用友好链接,在 vue.js 中构建 UI),例如 domain.com/mymodulename/login、domain.com/mymodulename/logout 等...
但是有一个客户的平台(打开友好链接),我的模块正在访问上面提到的任何请求的 url,但立即被重定向到 domain.com/lang/index.php?controller=404,状态为 404。
我无法在我的本地环境中重现该问题 - 下面的 htaccess 文件:
SetEnv HTTP_MOD_REWRITE On
RewriteEngine on
#Domain: presta.platformname.com
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %
{ENV:REWRITEBASE}
webservice/dispatcher.php?url=$1 [QSA,L]
Images
RewriteRule ^([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ % {ENV:REWRITEBASE}
img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9])?/.\.jpg$ %
{ENV:REWRITEBASE}
img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9])(-[\.*_a-zA-Z0-9-]*)(-[0-9])?/.+\.jpg$ %
{ENV:REWRITEBASE}
img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-])(-[0-9])?/.+\.jpg$ %
{ENV:REWRITEBASE}
img/c/$1$2.jpg [L]
AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
Dispatcher
RewriteCond % {REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME}
-l [OR]
RewriteCond %
{REQUEST_FILENAME}
-d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %
{ENV:REWRITEBASE}
index.php [NC,L]
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType font/woff2 .woff2
Header set Access-Control-Allow-Origin "*"
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
解决方案
推荐阅读
- javascript - 在 Django2.2 中引发 MultiPartParserError
- xamarin.forms - 从导航服务返回时如何保持上一页的页面状态?
- c# - 如何使用 c# mvc 获取 table1 中的所有 id 并保存到 table2?
- tomcat - Jasper 报告服务器:长时间运行的报告:504 网关超时错误
- node.js - 集中式环境变量
- graphql - 使用 Prismic 构建类别?
- c++ - 如何在 C++ 中的类中设置数组
- vue.js - 如何通过 spfx vue js 上的 rest api 从站点页面值中获取托管元数据字段
- django - 为什么在 Django admin 中使用只读字段时出现“TypeError:元定义类不可迭代”?
- java - 在 Bolt 的构造函数中初始化的变量为 null