Alexyb77 Posted December 4, 2020 Share Posted December 4, 2020 I am beginner in Prestashop dev. Need to override file webservice/dispatcher.php How can I do it? Didn't find suitable way (possible to override only clases and modules) Link to comment Share on other sites More sharing options...
elburgl69 Posted December 7, 2020 Share Posted December 7, 2020 I woult create a new file: webservices/my_dispatcher.php and change .htaccess to: RewriteRule . - [E=REWRITEBASE:/] RewriteRule ^api$ api/ [L] RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/my_dispatcher.php?url=$1 [QSA,L] Link to comment Share on other sites More sharing options...
Alexyb77 Posted December 7, 2020 Author Share Posted December 7, 2020 @elburgl69 Yes, it is the way, but sometimes user can regenerate htacess from Admin page. And the rewrite rule will be lost. Link to comment Share on other sites More sharing options...
elburgl69 Posted December 7, 2020 Share Posted December 7, 2020 Move the rule before prestashop block will prevent that: # ~~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 # ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again Link to comment Share on other sites More sharing options...
Alexyb77 Posted December 7, 2020 Author Share Posted December 7, 2020 Thanks a lot. 👍 It will help to make the code better (than I did when changed file dispatcher) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now