admin管理员组文章数量:1130349
How should I show the shop instead of a 404 page when a product is missing? Currently users get a 404 page which makes them loose interest.
I use woocommerce with wordpress on a server with nginx.
How should I show the shop instead of a 404 page when a product is missing? Currently users get a 404 page which makes them loose interest.
I use woocommerce with wordpress on a server with nginx.
Share Improve this question asked May 2, 2018 at 5:42 Ro LRo L 991 gold badge1 silver badge7 bronze badges1 Answer
Reset to default 1// Missing product redirect to product category
add_filter( 'rewrite_rules_array', function( $rules )
{
$new_rules = array(
'shop/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]',
'shop/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]',
);
return $new_rules + $rules;
} );
How should I show the shop instead of a 404 page when a product is missing? Currently users get a 404 page which makes them loose interest.
I use woocommerce with wordpress on a server with nginx.
How should I show the shop instead of a 404 page when a product is missing? Currently users get a 404 page which makes them loose interest.
I use woocommerce with wordpress on a server with nginx.
Share Improve this question asked May 2, 2018 at 5:42 Ro LRo L 991 gold badge1 silver badge7 bronze badges1 Answer
Reset to default 1// Missing product redirect to product category
add_filter( 'rewrite_rules_array', function( $rules )
{
$new_rules = array(
'shop/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]',
'shop/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]',
);
return $new_rules + $rules;
} );
本文标签: woocommerce offtopicshow shop instead of 404 page for missing products
版权声明:本文标题:woocommerce offtopic - show shop instead of 404 page for missing products 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749251318a2339743.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论