0

I'm trying to redirect my homepage http://magento246.local/ to http://magento245.local/

but

and other URLs after slash should work as and they should not redirect to another website. only the homepage should redirect when someone tries to access the homepage. but if he adds an extra URL with the homepage then it should not redirect. All this should work through .htaccess file customization.

1 Answer 1

0

To redirect only the homepage of a Magento 2.4.6 website to another site using .htaccess, you can use the following code snippet:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?magento246\.local$ [NC]
RewriteRule ^$ http://magento245.local [R=301,L]

This code ensures that only requests to the homepage (http://magento246.local/) are redirected to http://magento245.local, while other pages remain unaffected.

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.