TurnKey Linux Virtual Appliance Library

default index.php hyperlinks broken when running on non-default port

I have a turnkeylinux LAMP stack, and installed Jenkins on it.  I moved Jenkins to port 80, and changed apache to port 8080.  After doing so, the hyperlinks in the index.php page didn't work, because they showed up as https://server:8080:12320, instead of https://server:12320

The fix was super easy, just added a regex to strip off the existing colon and port number.


<a href="https://<?php print
$_SERVER{'HTTP_HOST'}; ?>:12321"><img


<a href="https://<?php print
preg_replace('/:\d+$/', '', $_SERVER{'HTTP_HOST'}); ?>:12321"><img

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)