# Magento 2 SEO Unique Catalog URLs

### <span style="color: rgb(59, 130, 246);">Installation and User Guide for Magento 2 SEO Unique Catalog URLs</span>

****Table of Contents****

1. [**Installation**](https://docs.scommerce-mage.com/magento-2-seo-unique-catalog-urls.md#toc_250008)
    - **Installation via app/code**
    - **Installation via Composer**
2. [**Configuration Settings for SEO Base**](https://docs.scommerce-mage.com/magento-2-seo-unique-catalog-urls.md#toc_250007)
    - **General Settings**
3. [**Configuration settings for Catalog URL**](https://docs.scommerce-mage.com/magento-2-seo-unique-catalog-urls.md#toc_250027)
    - **General Settings**
    - **Configuration Path to Set Up Primary Category**
    - **Primary Category settings for Category**
    - **Run the script to setup primary category of one or all products together**
4. [**Set Primary Categories**](https://docs.scommerce-mage.com/magento-2-seo-unique-catalog-urls.md#set-primary-categories)
5. [**Front-end Site View**](https://docs.scommerce-mage.com/magento-2-seo-unique-catalog-urls.md#toc_250024)
    - **Product Page Unique URL**
    - **Search Page / Category Page Unique Catalog Product URL**

### <span style="color: rgb(59, 130, 246);">Installation</span>

- ****Installation via app/code:****<span style="white-space: pre-wrap;"> Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory.</span>

```
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
```

- ****Installation via Composer:****<span style="white-space: pre-wrap;"> Please follow the guide provided in the below link to complete the installation via composer.</span>

<p class="callout success"><span style="white-space: pre-wrap;">[https://docs.scommerce-mage.com/magento-2-extensions/installation-via-composer/installation-via-composer](https://docs.scommerce-mage.com/magento-2-extensions/installation-via-composer/installation-via-composer)</span></p>

### <span style="color: rgb(59, 130, 246);">Configuration Settings for SEO Base</span>

<span style="white-space: pre-wrap;">Go to </span>**Admin &gt; Stores &gt; Configuration &gt; Scommerce Configuration &gt; SEO Base**

#### <span style="color: rgb(249, 115, 22);">General Settings</span>

- ****Enabled -****<span style="white-space: pre-wrap;"> Select “Yes” or “No” to enable or disable the module.</span>
- ****License Key -****<span style="white-space: pre-wrap;"> Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at </span><support@scommerce-mage.com>.

[![image.png](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/egtimage.png)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/egtimage.png)

### <span style="color: rgb(59, 130, 246);">Configuration Settings for Catalog URL</span>

<span style="white-space: pre-wrap;">Go to </span>**Admin &gt; Stores &gt; Configuration &gt; Scommerce Configuration &gt; Catalog URL**

#### <span style="color: rgb(249, 115, 22);">General Settings</span>

- ****Enabled -****<span style="white-space: pre-wrap;"> Select “Yes” or </span>****“****No****”****<span style="white-space: pre-wrap;"> to enable or disable the module.</span>
- ****Exclude Root Categories –****<span style="white-space: pre-wrap;"> Exclude some root categories to appear as primary category dropdown against products.</span>

<span style="white-space: pre-wrap;">[![image (1).png](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/CDNimage-1.png)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/CDNimage-1.png)</span>

### <span style="color: rgb(59, 130, 246);">Configuration Path to Set Up Primary Category</span>

<span style="white-space: pre-wrap;">Go to </span>**Admin &gt; Catalog &gt; Select Product &gt; Search Engine Optimization &gt; Primary Category**<span style="white-space: pre-wrap;"> . The drop down will show all the categories selected for the product from where you can select the primary category of the product.</span>

<span style="white-space: pre-wrap;">[![image.jpg](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/V2Qimage.jpg)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/V2Qimage.jpg)</span>

### <span style="color: rgb(59, 130, 246);">Primary Category settings for Category</span>

<span style="white-space: pre-wrap;">Go to </span>**Admin &gt; Catalog &gt; Categories &gt; Select Category &gt; Primary Category Settings.**<span style="white-space: pre-wrap;"> The drop down will show two primary category settings for the selected category: -</span>

- ****Exclude from Primary Category (Yes/No) -****<span style="white-space: pre-wrap;"> Select Yes/No whether you want this category to excluded from the primary category or not.</span>
- ****Exclude Root Categories –****<span style="white-space: pre-wrap;"> Set the priority for the category, the highest priority will be selected as the primary category.</span>

[![image (4).png](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/94simage-4.png)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/94simage-4.png)

### <span style="color: #3b82f6;">Run the script to setup primary category of one or all products together</span>

We have included a PHP script that can be utilized to set primary category for one or all products together. Simply run the script in the url and the primary categories will get updated for the set products.

- ****For one product –****<span style="white-space: pre-wrap;"> Run the script given and refer to the image below to update the primary category of a single product.</span>

```php
{{Website_URL}}/SetPrimaryCategoryM2.php?deleteSku s=MH01
```

[![image (1).jpg](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/amlimage-1.jpg)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/amlimage-1.jpg)

- ****For all Products –****<span style="white-space: pre-wrap;"> Run the script given and refer to the image below to update the primary category of all products.</span>

```php
{{Website_URL}}/SetPrimaryCategoryM2.php?deleteSkus=all
```

`<span class="editor-theme-code"><a href="https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/Vf9image-2.jpg" rel="noopener" target="_blank"><img alt="image (2).jpg" src="https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/Vf9image-2.jpg"></img></a></span>`

If the script doesen't work in the URL then make sure to place the script inside PUB directory and change line number 6 as follows:-

[![image.png](https://docs.scommerce-mage.com/uploads/images/gallery/2025-10/scaled-1680-/Tpbimage.png)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-10/Tpbimage.png)

Once updated, please run the script again.

### <span style="color: #3b82f6;">Set Primary Categories</span>

You can use a script provided with the extension to automatically add primary categories for products. Admin can exclude certain categories from primary category and also prioritise one category over the other to be picked as the primary category.

Go to **Admin&gt;Catalog&gt;Categories** select a category then scroll down to find the option "Primary Category Settings". Here click on "Exclude From Primary Category" to exclude this category from primary category or enter the priority 0 being the highes. The highest priority category will be picked first for the primary category.

[![image (3).png](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/3F5image-3.png)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/3F5image-3.png)

*****N.B -*****<span style="white-space: pre-wrap;"> <span style="color: rgb(224, 62, 45);">R</span></span>**un the script provided in the extension folder at the path Data/SetPrimaryCategoryM2.php from ssh**

### <span style="color: #3b82f6;">Front-end Site View</span>

- ****Product Page Unique URL -****<span style="white-space: pre-wrap;"> You can assign primary category to any product from </span>**Admin &gt; Catalog &gt; Select Product &gt; Search Engine Optimization &gt; Primary Category.**<span style="white-space: pre-wrap;"> In the below image you can see the assigned category of product Rival Field Messenger is "Gear-&gt;Bags"</span>****.****

[![image (3).jpg](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/image-3.jpg)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/image-3.jpg)

- ****Search Page / Category Page Unique Catalog Product URL –****<span style="white-space: pre-wrap;"> We have assigned “</span>****Strive Shoulder Pack****” product to “****Gear****” Category and the URL stays the same when we access the product from the search or category page.

[![image (4).jpg](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/scaled-1680-/image-4.jpg)](https://docs.scommerce-mage.com/uploads/images/gallery/2025-05/image-4.jpg)

If you have a question related to this extension please check out our [FAQ Section](https://docs.scommerce-mage.com/magento-2-google-global-site-tag-gtag.js-with-ga4-google-analytics-4-enabled.md#installation-and-user-guide-for-magento-2-how-did-you-hear-about-us-extension) first. If you can't find the answer you are looking for then please contact [**support@scommerce-mage.com**](mailto:core@scommerce-mage.com)**.**

<div component="pointer" id="bkmrk--11" option:pointer:page-id="22">  
</div><div component="pointer" id="bkmrk--12" option:pointer:page-id="22">  
</div>