We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53398
    • 8 Posts
    I try to make sitemap with pdoTools in the same way:

    Pagetitle:
    sitemap

    Alias:
    sitemap.xml

    Class key:
    document

    Content type:
    XML

    URI freezed for sitemap.xml

    Resource content:
    [[!pdoSitemap? &templates=`-40,-21,-5,-25`]]


    When I try to access it (sitename/sitemap.xml), Chrome shows en error "ERR_TOO_MANY_REDIRECTS".

    How to solve the problem?
      • 3749
      • 24,544 Posts
      The 'type' field should contain document, but the 'class_key' field should contain modDocument.

      If your sitemap is pulling in the 'content' field, make sure it doesn't include the page with the sitemap on it. That would make the sitemap snippet run an infinite number of times.

      If that doesn't do it, turn on Firefox or Chrome's dev. tools (Ctrl-shift-i) and watch the network tab as you access the page. That should show you what's happening.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 53398
        • 8 Posts
        I excluded the sitemap resource, but it didn't help. I turned on devtools in Chrome, it turned out that browser redirects to the main page endlessly:

        sitemap.xml/	301	text/html	sitemap.xml	  274 B	55 ms
        sitemap.xml/	301	text/html	mysiteurl.com/ 59 B	105 ms
        sitemap.xml	301	text/html	mysiteurl.com/ 300 B	60 ms
        sitemap.xml/	301	text/html	sitemap.xml	  274 B	52 ms
        sitemap.xml/	301	text/html	mysiteurl.com/  77 B	98 ms
        sitemap.xml	301	text/html	mysiteurl.com/ 300 B	57 ms
        sitemap.xml/	301	text/html	sitemap.xml	  274 B	53 ms
        

        and so on
          • 38783
          • 571 Posts
          What happens if you just call [[pdoSitemap]]
          Did you clear the cache after excluding the sitemap resource?
            If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

            email: [email protected] | website: https://andytough.com
            • 53398
            • 8 Posts
            Quote from: andytough at May 12, 2017, 12:10 AM
            What happens if you just call [[pdoSitemap]]
            Did you clear the cache after excluding the sitemap resource?

            The same thing happens
            Yes
              • 38783
              • 571 Posts
              Could you check that the frozen URI for sitemap.xml is correct? It should be sitemap.xml or /sitemap.xml

              If you have a .htaccess file what happens if you (temporarily) disable it?
                If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                email: [email protected] | website: https://andytough.com
                • 53398
                • 8 Posts
                Quote from: andytough at May 12, 2017, 08:43 AM
                Could you check that the frozen URI for sitemap.xml is correct?
                I've checked the frozen URI once again, it is "sitemap.xml"

                Quote from: andytough at May 12, 2017, 08:43 AM
                It should be sitemap.xml or /sitemap.xml
                When I change URI to "/sitemap.xml", browser redirects to sitename/sitemap.xml/

                Quote from: andytough at May 12, 2017, 08:43 AM
                If you have a .htaccess file what happens if you (temporarily) disable it?
                I little bit afraid of disabling it, because this site has visitors.

                Excuse me for such a long text, I a pasted the whole .htacces content here. I don't see here any redirects or rules that may obstruct.

                # MODX supports Friendly URLs via this .htaccess file. You must serve web
                # pages via Apache with mod_rewrite to use this functionality, and you must
                # change the file name from ht.access to .htaccess.
                #
                # Make sure RewriteBase points to the directory where you installed MODX.
                # E.g., "/modx" if your installation is in a "modx" subdirectory.
                #
                # You may choose to make your URLs non-case-sensitive by adding a NC directive
                # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
                
                RewriteEngine On
                RewriteBase /
                RewriteCond %{HTTP_HOST} ^www\.chestnyservice\.ru [NC]
                RewriteRule ^(.*)$ https://chestnyservice.ru/$1 [L,R=301]
                
                RewriteCond %{HTTP:X-Forwarded-Proto} !https
                RewriteRule ^ https://chestnyservice.ru%{REQUEST_URI} [L,R=301]
                
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_URI} !(.*)/$
                RewriteRule ^(.*[^/])$ $1/ [L,R=301]
                
                # url change
                RewriteRule ^iphone/$ / [R=301,L]
                RewriteRule ^macbook/(.*)/$ $1 [R=301,L]
                RewriteRule ^iphone/(.*)/$ $1 [R=301,L]
                RewriteRule ^macbook/(.*)/$ $1 [R=301,L]
                # end url change
                
                # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
                RewriteCond %{HTTP_HOST} .
                RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
                RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
                
                # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
                # https://www.domain.com when your cert only allows https://secure.domain.com
                #RewriteCond %{SERVER_PORT} !^443
                #RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
                
                # The Friendly URLs part
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                
                # Make sure .htc files are served with the proper MIME type, which is critical
                # for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
                
                #AddType text/x-component .htc
                
                # If your server is not already configured as such, the following directive
                # should be uncommented in order to set PHP's register_globals option to OFF.
                # This closes a major security hole that is abused by most XSS (cross-site
                # scripting) attacks. For more information: http://php.net/register_globals
                #
                # To verify that this option has been set to OFF, open the Manager and choose
                # Reports -> System Info and then click the phpinfo() link. Do a Find on Page
                # for "register_globals". The Local Value should be OFF. If the Master Value
                # is OFF then you do not need this directive here.
                #
                # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
                #
                # Your server does not allow PHP directives to be set via .htaccess. In that
                # case you must make this change in your php.ini file instead. If you are
                # using a commercial web host, contact the administrators for assistance in
                # doing this. Not all servers allow local php.ini files, and they should
                # include all PHP configurations (not just this one), or you will effectively
                # reset everything to PHP defaults. Consult www.php.net for more detailed
                # information about setting PHP directives.
                
                #php_flag register_globals Off
                
                # For servers that support output compression, you should pick up a bit of
                # speed by un-commenting the following lines.
                
                #php_flag zlib.output_compression On
                #php_value zlib.output_compression_level 5
                
                # The following directives stop screen flicker in IE on CSS rollovers. If
                # needed, un-comment the following rules. When they're in place, you may have
                # to do a force-refresh in order to see changes in your designs.
                
                #ExpiresActive On
                #ExpiresByType image/gif A2592000
                #ExpiresByType image/jpeg A2592000
                #ExpiresByType image/png A2592000
                #BrowserMatch "MSIE" brokenvary=1
                #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
                #BrowserMatch "Opera" !brokenvary
                #SetEnvIf brokenvary 1 force-no-vary
                AddDefaultCharset utf-8
                AddType 'text/html; charset=utf-8' .html .htm .shtml
                
                  • 38783
                  • 571 Posts
                  Could it be something to do with these lines?

                  RewriteCond %{HTTP:X-Forwarded-Proto} !https
                  RewriteRule ^ https://chestnyservice.ru%{REQUEST_URI} [L,R=301]


                  It looks like you have Cloudflare in place and apparently 'too many redirects' errors can be a problem when using https.

                  The following might be useful:

                  https://support.cloudflare.com/hc/en-us/articles/203487280-How-do-I-fix-mixed-content-issues-or-the-infinite-redirect-loop-error-after-enabling-Flexible-SSL-with-WordPress-

                  https://support.cloudflare.com/hc/en-us/articles/200170536-How-do-I-redirect-all-visitors-to-HTTPS-SSL-

                  http://stackoverflow.com/questions/26620670/apache-httpx-forwarded-proto-in-htaccess-is-causing-redirect-loop-in-dev-envir [ed. note: andytough last edited this post 6 years, 11 months ago.]
                    If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                    email: [email protected] | website: https://andytough.com