Question

inside my urlset I've come to urls like:

<url>
<loc>http%3A%2F%2Fwww.website.com%2F1-5%2Findex-3.html</loc>
<changefreq>weekly</changefreq>
<priority>0.700</priority>
</url>

If I copy paste that url doesn't work, I'm doing this via php with the urls:

$durl=utf8_encode(urlencode($durl));

utf8_encode first and then urlencode

is this correct?

Was it helpful?

Solution

urlencode is a way of converting a URL to be used in the query string or other url-sensitive areas - when you don't want the url parsed by the browser. Your goal here is to print the actual URL because that's what the sitemap parser wants.

You can the keep the utf8-encode but it's not likely needed if you're already doing things using utf8.

Just use $durl=utf8_encode($durl);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top