Module

Developer
Supported

Sitemap Module

ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5

Back to this add-on's main page
View Other Add-ons From PutYourLightsOn

     

You must be logged in to post.

Error - can’t locate www.mydomain.com/sitemap

Support Request

Robert Høegh
Robert Høegh

Can’ get this module to work correctly. I’ve done everything stated in the installation instructions, but when I go to www.mydomain.com/sitemap i am redirected to my 404 page.

I have a template group called site and within this group a template called sitemap. The sitemap template holds only this code:

{exp:sitemap:get} 

I have placed the sitemap.php in the root directory and the file holds this code:

<?php
/*
=====================================================
 Copyright (c) Ben Croker
 http://www.putyourlightson.net
=====================================================
Change the template below to your sitemap template
Put this file in the root directory of your site
Example: http://www.mydomain.com/sitemap.php
=====================================================
*/

// Change this to your sitemap template
$template 'site/sitemap';

$sitemap_url 'http://'.$_SERVER["HTTP_HOST"].'/index.php/'.$template;

// Set content to XML and UTF-8 encoded
header('Content-type: text/xml; charset=UTF-8');

// Choose a method and read template file

// cURL method
if (function_exists('curl_init'))
{
    $curl_handle 
curl_init($sitemap_url);
    
curl_setopt($curl_handleCURLOPT_POST1);
    
curl_setopt($curl_handleCURLOPT_POSTFIELDS$_GET);
    
curl_exec($curl_handle);
    
curl_close($curl_handle);
}

// readfile method
else
{    
    readfile($sitemap_url)
;
}

?> 

I’ve removed index.php from my site via .htaccess, and I suspect the problems may be a result of this. Perhaps I need to change something in this line, but what I do not know:

$sitemap_url 'http://'.$_SERVER["HTTP_HOST"].'/index.php/'.$template

Help would be much appreciated.

Best regards,
Robert

Robert Høegh
# 1
Robert Høegh

Was able to solve this myself. When removing index.php via .htaccess I forgot to grant access to to sitemap.php file in my root directory. Granting access did the trick.

Topic closed.

PutYourLightsOn
# 2
Developer
PutYourLightsOn

glad you got it working