Welcome! Log In Create A New Profile

Advanced

Need help to set rewrite rule in nginx

Posted by nathankmungia 
Need help to set rewrite rule in nginx
May 11, 2016 10:17AM
Hello,

I need help to set rewrite rule in nginx. Can anyone help me to set following rule in nginx? I have 2 files. Robots.txt and sitemap.xml that i need to rewrite. I have 2 domains both pointing to same server location having different sitemap file and robots.txt.

Domain1.com

- robots file name robots-domain1.txt
- sitemap file name sitemap-domain1.xml

Domain2.com

- robots file name robots-domain2.txt
- sitemap file name sitemap-domain2.xml

Now what i want to do is I need a rewrite rule that will show me robots-domain1.txt if i goes to http://domain1.com/robots.txt

Thanks & Regards,
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 84
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready