Lets say I have a site example.com with the following urls:
example.com
example.com/page1
example.com/about
This is an American site, but I also want an Australian version.
The urls for the Australian site will be:
example.com/au
example.com/au/page1
example.com/au/about
The homepage and page1
are identical on both sites so the same content is served. However there is an Australian specific version of about
so different content is served.
How can I map all of the /au
pages to the ones without /au
and somehow pass the fact that it is an AU page so I can determine what content to serve?
Update:
To clarify I want every single page that exists to be accessible via it's normal path alias, or the normal path alias prefixed with "au/".
I have managed to achieve this by editing bootstrap.inc in the following way:
A. Alter request_path()
. After the line:
$path = substr(urldecode($request_path), $base_path_len + 1);
I added:
if(substr($path, 0, 3) == 'au/') {
$path = substr($path, 3);
$_SESSION['au'] = TRUE;
} else {
$_SESSION['au'] = FALSE;
}
B. Alter drupal_settings_initialize()
. After the $base_path
has been set add:
if(isset($_SESSION['au']) && $_SESSION['au']) {
$base_path = '/au/';
}
This means both /page
and /au/page
are treated in exactly the same way and I can use $_SESSION['au']
in a node preprocessor hook to determine which content to serve.
Now my question is how can I achieve this behaviour without hacking the core?