I am unable to 301 redirect URL like

baseurl/blog/international%20enviroguard%20re-branding%20-%20faqs/ to baseurl/blog/international-enviroguard-re-branding-faqs through htaccess.

The page is going to 404 redirect.

I am using the below line to redirect in htaccess -

Redirect 301 /blog/international%20enviroguard%20re-branding%20-%20faqs/ /blog/international-enviroguard-re-branding-faqs

Please provide a solution.

  • is that apache server? Apr 22 '19 at 5:06
  • yes it is apache server
    – chanchal
    Apr 22 '19 at 5:08
  • 1
    Why you are using htaccess for this ? You can use To create a 301, 302 redirect, open the «Marketing» tab and select the «URL Rewrites» button. Apr 22 '19 at 5:13

Magento 2 Redirect (301, 302)

To implement 301 or 302 redirects in your Magento 2 store:

  1. a certain product or category in no longer available in your store;
  2. any kind of URLs changes;
  3. if you moved to a new website from an old one.

To create a 301, 302 redirect, open the «Marketing» tab and select the «URL Rewrites» button.

enter image description here

Then hit the «Add URL Rewrite» button. Let’s quickly look through the available options:

  • Store – select the Store View for which the redirect will be enabled
  • Request Path – enter the URL to redirect
  • Target Path – enter the URL to which the page will be redirected
  • Redirect Type – select the redirect type between 302 (temporary) and 301 (permanent)
  • Description – enter optional description

enter image description here

After specifying all the details, hit the «Save» button.

enter image description here

Now the customers and search engines will be redirected to the correct page and never encounter with a «404 Page Not Found» error in your Magento 2 store.

For more reference

  • I tried this first by creating url rewrite as - Requested path - blog/international%20enviroguard%20re-branding%20-%20faqs/ and target path - example.com/blog/international-enviroguard-re-branding-faqs But still not working.
    – chanchal
    Apr 22 '19 at 5:18
  • Which values did you set for Redirect Type ? Apr 22 '19 at 5:21
  • Redirect type - Permanent 301
    – chanchal
    Apr 22 '19 at 5:26
  • It should work please flush the cache and still it doesn't work then, you can use caching headers to do the same thing. Apr 22 '19 at 5:43
  • I reindexed and flushed cache also but still it is directing to 404 page. Please provide a solution.
    – chanchal
    Apr 22 '19 at 5:59

I found the solution by creating a new RewriteRule in htacces as - RewriteCond %{REQUEST_URI} "/blog/international\ enviroguard\ re-branding\ -\ faqs/" RewriteRule .* https://example.com/blog/international-enviroguard-re-branding-faqs [R=301,L]

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.