无法覆盖默认的 WooCommerce 商店页面
Can't override default WooCommerce Shop page
我购买了一个 Wordpress 模板,它带有一个非常漂亮的自定义商店页面。问题是实际上我无法将 permalink 设置为 www.example.com/shop/
因为它是默认的 WooCommerce 商店页面 link,所以我决定编辑 permalink到 www.mysite.com/my-shop/
但这不是我想要的。
此外,在任何时候,我都有两个不同的商店页面:www.example.com/my-shop/
页面和 www.example.com/shop/
的默认 WooCommerce 商店页面
我试图在 WooCommerce->Settings->Product->Display
中编辑 WooCommerce 商店页面,迫使商店页面指向我的自定义页面,但它实际上用 WooCommerce 的页面覆盖了我的自定义商店页面。
所以如果我去 www.example.com/my-shop/
它实际上显示了 Woocommerce 页面...
我该如何解决这个问题?
谢谢。
我的自定义商店页面也遇到了这个问题,我已经用 htaccess
重写规则解决了。您可以保留 woocommerce 商店页面。
然后在您的 htaccess
文件中添加如下内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch permanent /shop* http://www.example.com/my-shop/
# Then here below goes Wordpress rules and others…
</IfModule>
希望对您有所帮助。
The advantage is that I have a better SEO (as it's a custom shop page) like a normal page.
The WooCommerce shop page still exist but it's an empty page (no shortcode in it). Everything works perfect. In my menu (navigation) I have this Custom shop page link. If WooCommerce shop page is called from a link in product pages, the redirection is stunning straightforward.
我购买了一个 Wordpress 模板,它带有一个非常漂亮的自定义商店页面。问题是实际上我无法将 permalink 设置为 www.example.com/shop/
因为它是默认的 WooCommerce 商店页面 link,所以我决定编辑 permalink到 www.mysite.com/my-shop/
但这不是我想要的。
此外,在任何时候,我都有两个不同的商店页面:www.example.com/my-shop/
页面和 www.example.com/shop/
我试图在 WooCommerce->Settings->Product->Display
中编辑 WooCommerce 商店页面,迫使商店页面指向我的自定义页面,但它实际上用 WooCommerce 的页面覆盖了我的自定义商店页面。
所以如果我去 www.example.com/my-shop/
它实际上显示了 Woocommerce 页面...
我该如何解决这个问题?
谢谢。
我的自定义商店页面也遇到了这个问题,我已经用 htaccess
重写规则解决了。您可以保留 woocommerce 商店页面。
然后在您的 htaccess
文件中添加如下内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch permanent /shop* http://www.example.com/my-shop/
# Then here below goes Wordpress rules and others…
</IfModule>
希望对您有所帮助。
The advantage is that I have a better SEO (as it's a custom shop page) like a normal page.
The WooCommerce shop page still exist but it's an empty page (no shortcode in it). Everything works perfect. In my menu (navigation) I have this Custom shop page link. If WooCommerce shop page is called from a link in product pages, the redirection is stunning straightforward.