⌘mp.ws, which I prepared earlier, is now being used as the domain for my own URL shortener. I am using Shaun Inman‘s excellent Lessn software for this, but I had to tweak it a bit to get it to use my domain alias ⌘mp.ws instead of the longer maxpagels.com domain for the short URLs it generates.
It’s a short fix, really. Line eight of index.php
inside the -/
directory of my Lessn installation used to look like so:
[php firstline=”8″ toolbar=”false”]define(‘LESSN_DOMAIN’, preg_replace(‘#^www.#’, ”, $_SERVER[‘SERVER_NAME’]));[/php]
Th problem here is the PHP $_SERVER
variable that is used at the very end of the line. $_SERVER['SERVER_NAME']
returns the following, according to www.php.net:
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
In my case, $_SERVER['SERVER_NAME']
returned www.maxpagels.com. By replacing $_SERVER['SERVER_NAME']
with the domain alias ⌘mp.ws, everything started working as I wanted it to. So, if you find yourself in a similar situation, just replace this line:
[php firstline=”8″ toolbar=”false”]define(‘LESSN_DOMAIN’, preg_replace(‘#^www.#’, ”, $_SERVER[‘SERVER_NAME’]));[/php]
with this one:
[php firstline=”8″ toolbar=”false”]define(‘LESSN_DOMAIN’, preg_replace(‘#^www.#’, ”,’YOUR_DOMAIN_ALIAS’));[/php]
Then it’s just a matter of changing YOUR_DOMAIN_ALIAS
to, well, your domain alias.