Search code examples
apache.htaccesshttp-redirect

How to redirect an URL to another (.htacces)


Friends, I need to redirect an URL (which doen't exist in the blog anymore) to another one in the same blog. How could I do this with the help of .htaccess?

The problem is that we have a printed QR-Code which leads people to this old URL which was in our old blog. We have another one now, using the same subdomain. Any idea?

From

https://blog.mywebsite.com.br/2020/08/28/planner-para-que-serve-e-como-usar/

To

https://blog.mywebsite.com.br/planner-para-que-serve-e-como-usar/

I have tried this so far:

Redirect "https://blog.volarepaper.com.br/2020/08/28/planner-para-que-serve-e-como-usar/"
"https://blog.volarepaper.com.br/planner-para-que-serve-e-como-usar/"

and this as well:

Redirect "https://blog.volarepaper.com.br/2020/08/28/planner-para-que-serve-e-como-usar/"
 "https://blog.volarepaper.com.br/planner-para-que-serve-e-como-usar/"

Solution

  • You can not use full URL in the pattern of Redirect . You can only use URL path :

    Redirect 301 /2020/08/28/planner-para-que-serve-e-como-usar/ https://blog.volarepaper.com.br/planner-para-que-serve-e-como-usar/