![]() |
![]() |
|
| Condividi questo contenuto nei Social Network: |
|
Tweet |
|
|
|
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito. |
||||
|
|||||||||
Hey Amico Visitatore, Condividi con noi le tue idee e la tua conoscenza Aprendo una nuova discussione nella sezione Protocollo Sitemaps |
|
|
LinkBack | Strumenti di discussione |
|
|
#1 (permalink) |
|
User Newbie
Data di registrazione: Jan 2011
Ubicazione: busca
Messaggi: 6
|
sitemaps per sottodomini
Devo impostare un generator per sitemap automatico e che mi gestisca i sottodomini.
I sottodomini sono virtuali (alias). Mi servirebbe quindi un pannello per impostare sitemap torino.miosito.it milano.miosito.it ecc quindi mi dovrebbe memorizzare più creazioni di sitemap che eventualmente salvo in varie cartelle o meglio in root un sitemap che mi porta agli altri salvati in altre cartelle o con nome sitemaps1 , 2 ecc. Mi sapete dare indicazioni di generator che facciano al mio caso anche a pagamento? Io non ho trovato nulla. |
|
Ultima modifica di vnotarfrancesco : 01-03-11 12:19. Motivo: Maiuscole e punteggiatura |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Moderatore
|
Qualche tempo fà ho trovato questo codice :
Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Generatore di file XML per GOOGLE MAP</title> </head> <h1>Generatore di file XML per GOOGLE MAP</h1> <h2>Risultato della generazione automatica:</h2> <p> <?php // GESTISCE GLI URL DELLE DIRECTORY - NON MODIFICARE $dir = "./"; // MODIFICA LA VARIABILE dominio INSERENDO IL TUO DOMINIO $dominio = "http://www.NOMESITO.it"; // NOME DEL FILE CHE SARÀ AGGIORNATO. LA PRIMA VOLTA CREA UN FILE DI TESTO VUOTO E SALVALO COME NOME "NOMEFILE".XML $filexml = "sitemap.xml"; // I TIPI DI FILE CHE VUOI INCLUDERE NELLA GOOGLE SITEMAP $type = array ( "htm" , "html" , "php" ); // DICHIARAZIONE DELLA FREQUENZA DI AGGIORNAMENTO: never, hourly, daily, weekly, monthly, yearly, always $changefreq = "weekly"; // Dichiari la priorità da 0.1 a 1.0 $priority = "0.5"; // FINE EDIT AREA // NON MODIFICARE DA QUI IN POI echo "Document Root: ".$_SERVER['DOCUMENT_ROOT']."<br/>"; echo "Current Dir: ".str_replace("\\", "/" ,getcwd())."<br/>"; echo "Differenza: ".str_replace($_SERVER['DOCUMENT_ROOT'],"",str_replace("\\", "/" ,getcwd()))."<br/>"; $subdir = str_replace($_SERVER['DOCUMENT_ROOT'],"",str_replace("\\", "/" ,getcwd())); /* $header = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">"; */ $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n"; $footer = "</urlset>\n"; function read_recursiv( $path ) { $result = array(); $handle = opendir ( $path ); if($handle) { while(false!==($file=readdir($handle))) { if ($file!="." && $file!="..") { $name = $path."/".$file; if(is_dir($name)) { $ar = read_recursiv ( $name ); foreach($ar as $value) { $result[] = $value; } } else { $result[] = $name; } } } } closedir($handle); return $result; } $data = read_recursiv ( $dir ); $sitemap = fopen($filexml, "w"); fwrite($sitemap, $header); foreach($data as $value) { $value = str_replace($dir, "", $value); $temp2 = strtolower(substr($value, strlen($value)-2, strlen($value))); $temp3 = strtolower(substr($value, strlen($value)-3, strlen($value))); $temp4 = strtolower(substr($value, strlen($value)-4, strlen($value))); if((in_array($temp2, $type)) || (in_array($temp3, $type)) || (in_array($temp4, $type))) { fwrite ( $sitemap , "<url>\n<loc>".$dominio.$value."</loc>\n<lastmod>".date("Y-m-d", filemtime($_SERVER['DOCUMENT_ROOT'].$subdir.$value))."</lastmod>\n<changefreq>".$changefreq."</changefreq>\n<priority>".$priority."</priority>\n</url>\n" ); echo $dominio.$value."<br/>"; } } fwrite ( $sitemap , $footer ); fclose ( $sitemap ); echo "<br/>Google Sitemap creata con successo"; ?> <p><p></p> Sicuramente è da aprire e sistemare, ma già che fà il grosso del lavoro dovrebbe andar bene ![]() |
|
|
|
| Tags: sitemap sottodomini |
| Strumenti di discussione | |
|
|