By realer
I have two domains - lets call them engsite.com and frenchsite.com - running on a Nginx server.
When users visit frenchsite.com, I want them to be redirected to engsite.com/index_french.html
A /cname records? Or nginx redirects? Not sure how best to achieve this.
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!
This would be done by entering a server listener in Nginx, redirecting the domain on the server. You need to have a DNS A-record point to the same Nginx web-server’s IP-adress, as you normally would if frenchsite.com was in use. Then add this to the config:
server {
server_name frenchsite.com;
return 301 $scheme://www.engsite.com/index_french.html;
}
HTML status code 301 tells Nginx that the page/site has moved, and redirects the user to the given URL. If you would want to replicate everything that the user has written after the domain name, for instance http://frenchsite.com/news.html, using the “/news.html”-part in the new redirected URL, use it like this:
server {
server_name frenchsite.com;
return 301 $scheme://www.engsite.com$request_uri;
}
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.