Hi Juan,<br><br>Try using two server directives -- one for http and one for https. The server directive chosen depends on the port that is requested. Something like this:<br><br>server {<br> listen 80; # http<br> server_name <a href="http://www.yoursite.com">www.yoursite.com</a>;<br>
[...]<br> location /robots.txt {<br> break;<br> }<br>}<br>server {<br> listen 443; # https<br> server_name <a href="http://www.yoursite.com">www.yoursite.com</a>;<br> [...]<br> location /robots.txt {<br>
rewrite (.*) /robots_ssl.txt;<br> }<br>}<br><br><br><div class="gmail_quote">On Wed, Jan 7, 2009 at 9:06 AM, Juan Fco. Giordana <span dir="ltr"><<a href="mailto:juangiordana@gmail.com">juangiordana@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello list,<br>
<br>
I'm using nginx-0.6.34 with the try_files patch applied and I'm trying to serve an alternate robots.txt for requests on port 443 so pages under secure connections are not shown by web crawlers.<br>
<br>
I've tried many different approaches and couldn't get any of them to work as I expected:<br>
<br>
if ($server_port = 443)<br>
if ($remote_port = 443)<br>
if ($scheme = https)<br>
With and without the location block.<br>
if () blocks inside @try_files rule.<br>
redirect flags: break, last, pemanent.<br>
All rewrite rules disabled except the one in question.<br>
<br>
server {<br>
[...]<br>
location /robots.txt {<br>
if ($server_port = 443) {<br>
rewrite ^robots\.txt$ robots_ssl.txt last;<br>
}<br>
}<br>
[...]<br>
}<br>
<br>
Most of these approaches returned always robots.txt on both SSL and NON-SSL while others 404 error under SSL. None robots_ssl.txt.<br>
<br>
Am I doing something wrong?<br>
<br>
Thanks!<br>
<br>
</blockquote></div><br>