Jump to content

international website help


oracle765

Recommended Posts

<link rel="canonical" href=http://www.example.com />
<link rel="alternate" hreflang="en" href="http://www.example.com.au" />
<link rel="alternate" hreflang="en-AU" href="http://www.example.com.au" />
<link rel="alternate" hreflang="en-GB" href="http://www.example.com" />

we include this in the head for every page of which we have thousands of pages.  our body.php includes our header information... So for the contact us page it would change to

<link rel="canonical" href=http://www.example.com/contact_us />
<link rel="alternate" hreflang="en" href="http://www.example.com.au/contact_us" />
<link rel="alternate" hreflang="en-AU" href="http://www.example.com.au/contact_us" />
<link rel="alternate" hreflang="en-GB" href="http://www.example.com/contact_us" />

Hi professionals

 

We are currently in the process of doing another country website and we are curious if there is a way to pull the page url's through php dynamically

 

for example on every webpage we will have for the UK a reference to our Australian site

 

 

Link to comment
https://forums.phpfreaks.com/topic/295275-international-website-help/
Share on other sites

EMPTY RESULT

<!--THIS IS WHERE WE NEED TO INTERNATIONALISE THE WEBSITE
		<link rel="canonical" href= />
		<link rel="alternate" hreflang="en" href="" />
		<link rel="alternate" hreflang="en-AU" href="" />
		<link rel="alternate" hreflang="en-GB" href="" />
		END OF INTERNATIONALISATION-->


SOME OF THE PAGE CODE


<?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();

/*UK URL */
$ukURL = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
//echo $ukURL;

/*Australian URL*/
$auURL =  str_replace("www.example.com", "www.example.com.au", $ukURL);
//echo $auURL;

 
class Body
{
    function getHead($title,$meta)
    {
        $head='<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<!--THIS IS WHERE WE NEED TO INTERNATIONALISE THE WEBSITE
		<link rel="canonical" href='.$ukURL.' />
		<link rel="alternate" hreflang="en" href="'.$auURL.'" />
		<link rel="alternate" hreflang="en-AU" href="'.$auURL.'" />
		<link rel="alternate" hreflang="en-GB" href="'.$ukURL.'" />
		END OF INTERNATIONALISATION-->
		<title>'.$title.'</title>'.$meta.'<!-- Le styles --><script>function isNumberKey(e){var h=e.which?e.which:event.keyCode;return h>31&&(48>h||h>57)?!1:!0}</script><link href="'.SITE_URL.'css/bootstrap1.css" rel="stylesheet"><style>@media screen and (min-width:320px) and (max-width:599px){.footer-container .inner ul.social-panel{padding: 0 0 20px;}.dmca-badge{margin-left: 0;}}</style><link href="'.SITE_URL.'images/favicon.ico" rel="icon" type="image/x-icon" /><script src="'.SITE_URL.'js/jquery.min.js"></script><meta name="google-translate-customization" content="18b8d42576b51740-def29c5a9d056870-gd2b9850af279795c-1b"></meta><meta name="robots" content="noindex"><meta name="googlebot" content="noindex">
</head>';
        return $head;
    }

hi again professionals just a quick update.

 

I have tried this but its not showing any output just blank as shown, also please find attached the code.  when I echo this out above the function it works fine...any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.