Thank you both for the insight.<br><br>-Jake<br><br><br><div class="gmail_quote">On Fri, Apr 11, 2008 at 11:04 AM, Igor Sysoev &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Wed, Apr 09, 2008 at 03:26:57PM -0400, J Davis wrote:<br>
<br>
&gt; Greetings.<br>
&gt;<br>
&gt; I want to redirect certain URL&#39;s to https. I&#39;ve come up with a few ways that<br>
&gt; I think will work but I&#39;m wondering which method is more efficient in terms<br>
&gt; of how much processing nginx would do.<br>
&gt;<br>
&gt; 1st method: multiple &#39;location&#39; sections.<br>
&gt;<br>
&gt; location /sub1 {<br>
&gt; &nbsp; &nbsp; rewrite ^(.*) https://$host$1 redirect;<br>
&gt; }<br>
&gt; location /sub2 {<br>
&gt; &nbsp; &nbsp; rewrite ^(.*) https://$host/sub2 redirect;<br>
&gt; }<br>
&gt;<br>
&gt; 2nd method: one location w/ multiple redirects.<br>
&gt;<br>
&gt; location / {<br>
&gt; &nbsp; &nbsp; rewrite ^(/sub1.*) https://$host$1 redirect;<br>
&gt; &nbsp; &nbsp; rewrite ^(/sub2.*) https://$host$1 redirect;<br>
&gt; }<br>
&gt;<br>
&gt; 3rd method: match using $scheme.<br>
&gt;<br>
&gt; if ($scheme ~ http) {<br>
&gt; &nbsp; &nbsp; rewrite ^(/sub1.*) https://$host$1 redirect;<br>
&gt; &nbsp; &nbsp; rewrite ^(/sub2.*) https://$host$1 redirect;<br>
&gt; }<br>
&gt;<br>
&gt; My guess is that method 1 would be more efficient because rewrite processing<br>
&gt; would only happen if the location matched.<br>
<br>
</div></div>1st method is the faster.<br>
As to matching $scheme: you have to create two virtual servers - http and https,<br>
so http server will always have &quot;http&quot; scheme.<br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</font></blockquote></div><br>