Flexible Content Management System


ServerAliases and single postnuke, redirect the right url name

Contributed by Nice addition! We'l on Sep 04, 2001 - 11:26 PM

Today i scratched my head on this, trying several Apache config tweeks with no good results. What i wanted was the url beying redirected and replaced in the browser in order to unify host names.

Say someone ask for or and he is stright redirected to or what is stored in the postnuke preferences and this is what will be bookmarked and allowed to robots.

I added this to postnuke and this is a matter of 5 lines added to header.php

Right after :


Insert this:

global $HTTP_HOST, $nukeurl;

if("http://$HTTP_HOST/" != $nukeurl) {

header("Status: 301 Moved Permanently");

header("Location: $nukeurl");


This just compare the host name in the HTTP request with the postnuke settings. If they don't match, the client is permanently redirected to the right url. The status 301 state robots and proxys, the alias name that drove them here is not for any storage.

Please tell if this behaviour is suitable for everybody, if this should be left as an options or beying a standard postnuke feature. Do you want this included in a next postnuke release ?

Léa Gris