nettulf - 7:34 pm on Feb 6, 2013 (gmt 0) [edited by: nettulf at 8:00 pm (utc) on Feb 6, 2013]
What you need is some code that "computes" the page you are on.
On my shared hosting I have the following code that works on all my pages and subdirectories, even between websites. Maybe you could try?
NB it might give a different result on your host, so make a backup first and look at the output. Maybe show the output here if it does not give the correct result? Put it somewhere between <head> and </head> in the include above.
<?if( basename($_SERVER['PHP_SELF']) == "index" ):?>
<link rel="canonial" href="<?='http://' . $_SERVER['SERVER_NAME']?>">
<link rel="canonial" href="<?='http://' . $_SERVER['SERVER_NAME'] . parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH)?>">
Edit: Just tested and seems like the if-statement is unnecessary, it shows the homepage correct without it. But the code works so I am leaving it in. :)
[edited by: nettulf at 8:00 pm (utc) on Feb 6, 2013]