I'm trying to build a sitemap for my site. so far i was succeeded to build it.
Now i notice that i have some urls that related to other urls. which they are contain 90% of my site's urls.
For example i have this url:
www.mysite.com/mainurl
and those url which related to above url:
www.mysite.com/mainurl/mypage1
www.mysite.com/mainurl/mypage2
www.mysite.com/mainurl/mypage3
I was wondering if there is a way to related second urls to first url, something like sub url.
Also i have an other question, which type of url's format i should use?
This type: www.mysite.com/mainurl
or this type: www.mysite.com/page.php?url=mypage1
Perhaps consider using PHP's explode function to split the url, then compare the values in a loop, something like:
$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['www.mysite.com']['mainurl']['mypage1'];
// $items['www.mysite.com']['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 style of URL's, they are better for SEO.