We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25519
    • 265 Posts
    Hi all

    When upgrading I always set the site to ’Unavailable’ with an unavailable page specified, but when upgrading I never normally look at how the given site/url actually displays as I’m too busy upgrading wink

    I generally use the ’alternative method’ of upgrading, as described here:
    http://wiki.modxcms.com/index.php/Upgrading_Guide

    This may sound a bit daft, but what I want to know is when using either this upgrade method or the more standard overwriting method, what would a potential viewer of the site actually see??? I checked it on one occassion but only saw a blank white page - upgrade went fine btw, but the blank page was not ideal.

    Ideally I want the site unavailable page visible during upgrade, but as everything is being written/overwritten is this possible?

    Thanks in advance
    • TBH, it’s very hard to know how your specific upgrade steps will affect the site. The safest (and easiest) thing to do IMO, is put an alternate index.html or index.php (make sure you don’t overwrite it with the new modx index.php) in the root with the downtime message and use .htaccess to direct all requests to it. That will ensure there is something for visitors to see while you are performing the upgrade.
        • 25519
        • 265 Posts
        Would this do the trick, right at the bottom of the .htaccess file? :
        # Provide Specific Index Page (Set the default handler)
        DirectoryIndex index.html

        Thanks
        • No, the problem is, what if they go directly to URL inside your site. You want to redirect everything to your static file with something like this...
          RewriteRule ^(.*)$ index.html [L,R=301]

          NOTE: Make sure you put this before your MODx rewrite rules for friendly URLs, if you are using those.
            • 25519
            • 265 Posts
            Many thanks!
            Please see my commented out addition:
            ... ...
            #php_flag register_globals Off
            #AddDefaultCharset utf-8
            #php_value date.timezone Europe/Moscow
            
            # ADD THIS RULE FOR DIRECTING TO STATIC PAGE DURING UPGRADES
            # RewriteRule ^(.*)$ index.html [L,R=301]
            
            Options +FollowSymlinks
            RewriteEngine On
            RewriteBase /
            ... ... etc
            

            If you think this is in the correct place then i’m gonna add this to all future upgrades.
            • Must be after RewriteEngine and RewriteBase commands.
                • 25519
                • 265 Posts
                How’s this look:
                Options +FollowSymlinks
                RewriteEngine On
                RewriteBase /
                
                # ADD THIS RULE FOR DIRECTING TO STATIC PAGE DURING UPGRADES
                # RewriteRule ^(.*)$ index.html [L,R=301]
                
                # Fix Apache internal dummy connections from breaking [(site_url)] cache
                RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
                RewriteRule .* - [F,L]