向Prestashop添加自定义重写规则

向Prestashop添加自定义重写规则,prestashop,Prestashop,通常我们在wordpress插件中添加重写url,如下所示 function custom_rewrite_basic() { add_rewrite_rule('^leaf/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic'); 在prestashop自定义模块中添加重写url的过程是什么。 我想在自定义模块中处理url请求。 例如,url

通常我们在wordpress插件中添加重写url,如下所示

function custom_rewrite_basic() {
  add_rewrite_rule('^leaf/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top');   
}
add_action('init', 'custom_rewrite_basic');
在prestashop自定义模块中添加重写url的过程是什么。 我想在自定义模块中处理url请求。

例如,url请求
localhost/prestashop/newpage.php
和文件位于
localhost/prestashop/modules/mymodules/includes/newpage.php

如果您使用的是prestashop 1.4,那么您可以在backoffice>Tools>Generators中插入自定义规则


如果您使用的是prestashop 1.5或更高版本,则可以直接修改.htaccess,但应将自定义规则放在下面的注释之前

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