1

Here's the situation I need to redirect one of my product to homepage make it as homepage at the same time the URL must be changed to home, so instead of www.example.com/sample-product it should be www.example.com take note that I am accessing this link www.example.com/sample-product.

I am also confused if I'm going to use the rewritten URL.

What would be the best approach?

2

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.

  1. 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.

  1. 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.

  1. 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.

  • The product redirect but still, it display the homepage it should be displaying the product as the homepage. Thanks for your time to answer my question – Richmond Azarraga Aug 16 '17 at 15:10
  • Oh ok so you want the homepage to be that product page? And you can access this homepage via www.domain.com/sample-product and if you access www.domain.com? – harri Aug 16 '17 at 15:15
  • Yes that's what we want to achieve. – Richmond Azarraga Aug 16 '17 at 15:16
  • I have updated answer – harri Aug 16 '17 at 15:33
  • Glad you got it going, Could you mark as answer? – harri Aug 17 '17 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.