<div>Hi Olly,</div><div><br></div><div>I'm assuming you're using Apache, and guessing your redirect is currently done in an .htaccess file.</div><div>If you could use PHP instead then you could access the server's address with the server variable $_SERVER['SERVER_ADDR'] and use a header() statement to send the browser a redirect.</div>
<div><br></div><div>See <a href="http://php.net/manual/en/reserved.variables.server.php">http://php.net/manual/en/reserved.variables.server.php</a> and <a href="http://php.net/manual/en/function.header.php">http://php.net/manual/en/function.header.php</a></div>
<div><br></div><div>Your code would probably look something like</div><div><br></div><div><?php</div><div>    header('Location: https://' . $_SERVER['SERVER_ADDR'], true, 301);</div><div>?></div><br>
Stick that in index.php in the root directory of your server and you've got a start. It'll only redirect requests to the bare domain though... if you want to redirect ALL non-HTTPS site requests then you might need something in .htaccess to rewrite them all to index.php<div>
<br></div><div>Also if you're serving the same directory for both protocols, you might need to do some work with $_SERVER['HTTPS'] to detect how you got here.</div><div><br></div><div>Jon<br><div><br></div><div>
<br></div><div><div class="gmail_quote">On Thu, Feb 21, 2013 at 1:20 AM, Oliver Marshall <span dir="ltr"><<a href="mailto:oliver.marshall@g2support.com" target="_blank">oliver.marshall@g2support.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Chaps<div><br></div><div>Not quite the right list I know but I have a quick HTTPD redirect question. </div>
<div><br></div><div>I have a redirect line that redirects all HTTP requests to the HTTPS IP of my little test server. </div>
<div><br></div><div>Currently it has a fixed internal IP. </div><div><br></div><div>I need to change the redirect line so that it will redirect to whatever the current IP of the server is, rather than a fixed IP. </div>
<div><br></div><div>That is, the server itself will be going to a client for testing, but they have DHCP only and no access to the DHCP service to assign a static IP. They also have no internal DNS. They work from a serviced office and the serviced office hardware just hands out IPs. As such the IP of the server will change every 4 to 8 hours or so and I need the redirect to be able to redirect to whatever the current IP address is.</div>

<div><br></div><div>Can that be done?</div><div><br></div><div>Olly</div></div>

<br>
<img alt="" style="font:normal normal normal medium/normal 'Times New Roman'"><span style="font:normal normal normal medium/normal 'Times New Roman'"></span><table border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" style="width:500px">
<tbody><tr><td valign="top" width="220"><img alt="" width="220" height="69"></td><td valign="top" width="280" align="left"><div style="margin-top:10px"><font color="#808080" face="Calibri">Network Support<br>Online Backups<br>
Server Management</font></div></td></tr><tr><td colspan="2"><p><font color="#000000" face="Calibri">Tel: 0845 307 3443<br>Web: <a href="http://www.g2support.com/" target="_blank">http://www.g2support.com</a><br>Twitter: <a href="http://twitter.com/home?status=@g2support" target="_blank">g2support</a><br>
Google+: <a href="http://www.g2support.com/plus" target="_blank">http://www.g2support.<u></u>com/plus</a><br>Facebook: <a href="http://www.facebook.com/g2support" target="_blank">http://www.facebook.com/<u></u>g2support</a><br>
Mail: Unit H, Hove Technology Centre, Hove, Sussex, BN3 7ES<br></font></p><p><font color="#000000" face="Calibri">Have you said something nice about us to a friend or colleague ? Let us say thanks. Find out more at <a href="http://www.g2support.com/referral" target="_blank">www.g2support.com/referral</a></font></p>
<p><font face="Calibri"><font color="#808080">G2 Support LLP is registered at Mill House, 103 Holmes Avenue, HOVE<br>BN3 7LE. Our registered company number is OC316341.</font></font></p></td></tr></tbody></table><br><div>
<img>  <span style="font-size:1.3em"> </span><img style="font-size:1.3em">   <img style="font-size:1.3em"></div><br>--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
<br></blockquote></div><br></div></div>