You can just use the rewrite where request path is sample-product
and the target path is ../
. Anyone visiting the URL www.domain.com/sample-product will end up at www.domain.com. The default homepage will also need to be set to your product.
- Navigate to Marketing -> SEO & Search -> URL Rewrites
Find the Magento path of the Product URL by looking within the Rewrite table. I typed in URL of product you want to be your homepage in target path and found request path for that particular product.
e.g. catalog/product/view/id/1
Make a note of this URL.
- Navigate to Stores -> Configuration -> General -> Web -> Default Pages
Set the Default Web URL to your product e.g. catalog/product/view/id/1
Accessing www.domain.com will now show your product.
- Navigate to Marketing -> SEO & Search -> URL Rewrites -> Add URL Rewrite
a. Set Request Path: sample-product
b. Set Target Path: ../
c. Set Redirect Type: Permanent
This sets your product URL so that it will be redirected to the homepage also.