By KodebitsACC
Hi community!
I need to redirect some URL to root, because we redesign all entire site to new urls and now its going to 404 page, and I dont know how but Im having problems with that.
url : /contacto.htm to domain.
I include this command in server block
server { location = /contacto.htm { return 301 http://www.domain.es } }
Its good or bad? I dont know… I hope that you can help me. I need to do 12 redirects…
Kind regards!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi!
Yes, that works. However, if you will be doing 12 different redirects, it might be easier to use a regex pattern instead:
location ~* ^(contacto\.htm|file2\.htm|etc) {
return 301 http://www.domain.es;
}
Make sure you escape the periods so that RegEx does not parse them as the wildcard character (which matches anything) by adding a backslash before each one. So contacto.htm becomes contacto\.htm.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.