Page is a not externally linkable
mihomes - 3:24 pm on Oct 20, 2012 (gmt 0)
www.example.com/news/ is a physical location and has a few directories and other files for the cms... the main file being the www.example.com/news/index.php template file which outputs every file for the cms. This is where the htaccess for it comes into play with the file exist and directory not exist because those categories and articles it creates as folders out of the /news/ are not physical (they are mapped to sql database in some manner).
I did find that <base href="www.example.com/news/"/> is set on this index.php (the template file) and appears to help populate the correct links on the page, however, if I go to the non-www version it of course becomes <base href="example.com/news/"/>
The 'site' link used in that base is created by :
function site() {
$host = 'http://'.$_SERVER['HTTP_HOST'];
$directory = dirname($_SERVER['SCRIPT_NAME']);
$website = $directory == '/' ? $host.'/' : $host.$directory.'/';
return $website;
}
in a separate php file that is php included in the index.php template file.
Now, if I change that above function to always return http://www.example.com/news/ then that forces all links in the pages (the template file) to be www since that is the base. Problem is I can still manually type an address in the URL without the www and it will show up(no redirect), yet since the base is www all links on the page are correct.
If there is a way to force that index.php to always be www version then that would solve everything, but for whatever reason that is not happening with the code in the htaccess.