How to optimize static paths in Woocommerce

Tutorials 0 lượt xem

After installing Woocommerce , you need to optimize the static path so that it is beautiful and SEO friendly.

In today’s post, I will share some tips related to static path optimization.

Change the static link for Woocommerce

To change the static path for Woocommerce, go to Settings -> Static Path

Here, you will see 3 sections as below:

set up static path for woocommerce 2

In the common settings, you will choose the title of the post. This is the recommended static path setup for every WordPress site.

The two sections below will apply to Woocommerce.

By default, the product category page will look like this: http://yourdomain.com/danh-muc/clothing/ . You will notice that the word category (product-category) will always be in the path.

The product detail page will look like this : http://getwpdev.com/san-pham/happy-ninja/ . Similarly, the word san-pham (product) will always be in the URL.

Now I will share 2 ways to set up static path for Woocommerce

Remove the word san-pham (product) and catalog (product-category) in the path

Update 2/11/2017: You should follow the how-to here .

To remove san-pham, add the following code to the functions.php file. Remember to create a child theme before making changes. Then go to Settings -> Static Path and click the Save Changes button.

To delete the product-category, we use the WP Htaccess Control plugin . After installing and activating the plugin, you go to Settings -> htaccess control . Click on Remove Taxonomies and Author Base to see more options. Check the option Remove Base product categories . Remember to click the Save all changes button to save your configuration:

set static path for woocommerce 1

How to set the base of the product category page to the base of the product page.

Above, you already know how to remove the word san-pham (product) and list-muc(product-category) from the URL. Now we will set up completely different. Specifically, after you do the way I shared below, we will have the following path structure:

  • Product page: http://yourdomain.com/san-pham
  • Category page: http://yourdomain.com/san-pham/ten-danh-muc
  • Details page: http://yourdomain.com/san-pham/danh-muc/ten-san-pham

First we create a product page with slug or path as san-pham

set up static path for woocommerce 3

Then go to Woocommerce -> Settings -> Products -> Display. Select the Products page in the Shop Page option. Click Save Changes

set up static path for woocommerce 4

Next, you go to Settings -> Static Paths . In the additional options section, you enter the san-pham in the Default product category.

Scroll down, in the static product path, enter /san-pham/%product_cat%

Click Save Changes.

set up static path for woocommerce 5

Finally, add the following code to the functions.php file:

So far, you have learned 2 ways to optimize static URLs for Woocommerce.

Let me know if you have any other good ways in the comments section below.

If you liked this article, don’t forget to subscribe to your email to receive notifications of new posts. Thank you very much.

Bài viết liên quan