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?

1

1 Answer 1

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.

6
  • 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 Commented Aug 16, 2017 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
    Commented Aug 16, 2017 at 15:15
  • Yes that's what we want to achieve. Commented Aug 16, 2017 at 15:16
  • I have updated answer
    – harri
    Commented Aug 16, 2017 at 15:33
  • Glad you got it going, Could you mark as answer?
    – harri
    Commented Aug 17, 2017 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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