rustyclockwork Posted January 28, 2010 Share Posted January 28, 2010 The canonical linking is messed up for some reason. Below is a section of my source code when viewing the main page on the site. <base href="http://www.oldfoundry.com/catalog/"> <link rel="canonical" href="http://www.oldfoundry.co/catalog/" /> <link rel="stylesheet" type="text/css" href="stylesheet.css"> Why in the world is it not adding the "m" to the .com on the second line? And where can I find this? I've looked at all the main files. It's not in the configuration file either. Thanks, Jason Link to comment Share on other sites More sharing options...
cemfundog Posted January 28, 2010 Share Posted January 28, 2010 The canonical linking is messed up for some reason. Below is a section of my source code when viewing the main page on the site. <base href="http://www.oldfoundry.com/catalog/"> <link rel="canonical" href="http://www.oldfoundry.co/catalog/" /> <link rel="stylesheet" type="text/css" href="stylesheet.css"> Why in the world is it not adding the "m" to the .com on the second line? And where can I find this? I've looked at all the main files. It's not in the configuration file either. Thanks, Jason You should be able to find this code at the top of your index.php file. It will also be on several other pages if you have copied them when adding more pages like I do. When viewing the source code in Firefox of your home page I can see the error at the top. You need to add the "m" to the dot com and save it that way. Then upload to your host. If I am not missing something that should be all you need to do. Good luck... Link to comment Share on other sites More sharing options...
rustyclockwork Posted January 28, 2010 Author Share Posted January 28, 2010 Hi cemfundog, Unfortunately, that won't do it since these are PHP files... something isn't processing the information provided in the configuration file correctly. You see, index.php gets the URL info from another file. I wish I could simply edit it like you said, but I need to find out if there a source file misspelled, or if it is a parsing error. Thank you though, I'm still stuck, Jason Link to comment Share on other sites More sharing options...
rustyclockwork Posted January 28, 2010 Author Share Posted January 28, 2010 I might of gotten it to work: I modified the tag function: // starts canonical tag function - www.webshoptimizer.com function CanonicalUrl() { $domain = substr((($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER), 0, -0); // gets the base URL minus the trailing slash $string = $_SERVER['REQUEST_URI']; // gets the url $search = '\&osCsid.*|\?osCsid.*'; // searches for the session id in the url $replace = ''; // replaces with nothing i.e. deletes echo $domain . ereg_replace( $search, $replace, $string ); // merges the variables and echoing them } // eof - canonical tag I had changed this line: $domain = substr((($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER), 0, -0); // gets the base URL minus the trailing slash To a -0 Now my source is this: <base href="http://www.oldfoundry.com/catalog/"> <link rel="canonical" href="/catalog/" /> <link rel="stylesheet" type="text/css" href="stylesheet.css"> Link to comment Share on other sites More sharing options...
MrPhil Posted January 28, 2010 Share Posted January 28, 2010 The original code apparently is only supposed to remove a trailing / from HTTP_SERVER, so when the REQUEST_URI is attached (/something-or-other) you only get a single /. Now, that's clearly a coding error, because HTTP_SERVER is not supposed to end with a /. You could change $domain = substr((($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER), 0, -0); // gets the base URL minus the trailing slash to $domain = ($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER; // gets the base URL Worth a try... Link to comment Share on other sites More sharing options...
rustyclockwork Posted January 29, 2010 Author Share Posted January 29, 2010 Hi there, I don't think it's really doing anything for me... I didn't realize that Header Tags v3.0 had a canonical link feature built-in. And I had installed the canonical contrib from www.webshoptimizer.com as well. ...think I'll remove that one and leave the Header Tags v3.0 installed. Thanks, Jason Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.