Create additional url in sitemap

I am trying to create a sitemap for my site. so far I've managed to build it.

Now I notice that I have URLs linked to other URLs. which contain 90% of my site urls.

For example, I have this url:


and those urls that are associated with the above url:


I was wondering if there is a way to associate secondary urls with the first url, something like sub url.

Also I have another question, what type of URL format should I use?

This type:

or this


source to share

1 answer

Perhaps consider using PHP's break function to split the url, then compare the values ​​in a loop, like so:

$items = get_your_array();

foreach($items as $item)
    $urlParts = explode...
    foreach($urlParts as $part => $val)
        // Organise parts into an associative array, so you can loop over it later
        // This would produce something that also could be accessed like...
        // $items['']['mainurl']['mypage1'];
        // $items['']['mainurl']['mypage2'];
        // Having the array key the same as the value as it would probably filter out duplicates, so you need to consider that


As for your second questions, use the first url style, they are better for SEO.



All Articles