@daisha
In a CodeIgniter application, you can call the sitemap.xml file by creating a controller and then loading the view file for the sitemap.
Here's an example of how you can do this:
1 2 3 4 5 6 7 8 |
<?php
class Sitemap extends CI_Controller {
public function index() {
$this->load->view('sitemap');
}
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php
header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc><?php echo base_url(); ?></loc>
<lastmod><?php echo date('c', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<!-- Add more URLs for your sitemap here -->
</urlset>
|
By following these steps, you can create a sitemap.xml file in your CodeIgniter application and access it through a controller.