How to build a MODx site Behind a static HTML version so that after I finish the MODx CMS (and all its lovely features) I can take the static HTML page offline and reveal the MODx pages.
I know about the [Under Construction / Maintenance page, but its not working for me.
I always struggle to set this up and have a nice workflow without clients and customers being bothered with an in-development website.
Without know how large or complex the site is, could create a empty template and copy the static html into the content area? Then you could replace the pages as you go.
You could develop the new site locally or under a subdomain. Then when everything is ready, upload the new files or just set the root of the site to the folder of the subdomain.
I usually do what @vibedesign suggested - but if you wanted to keep it very simple - you could try temporarily changing your default document via the .htaccess file in your site root:
#Alternate default index page
DirectoryIndex index.html
Upload your index.html file and any others relevant to your temporary site to the root directory.
This should point yourdomain.xyz to the index.html file [instead of MODX’s index.php file].
When your MODX site is ready to go - just comment out or delete the above .htaccess lines.
@vibedesign Thanks, Do you have a good (step-by-step) manual to guide me trough the process? It’s quite tricky to get it just right to make sense out of all of this.
@dejaya thank you, this sounds like the thing I would use. It’s the least complex option in my opinion. It’s just one setting I’ll have a go with that one.
Q. Does it mean that during the MODx installation the current site will be unreliable until I change the .htaccess file?
I suppose it would mean that links in your MODX site that pointed at the root of the site [yourdomain.xyz etc] would flip over to the live, temporary site home page instead of your MODX home page.
If your temporary site is straightforward HTML - I think it should work as expected
So the easiest solution would still be the maintenance-mode - so what do you mean exactly with “it’s not working for me”?
The second best option, that I also use a lot, is the switching of document-roots in your hosting-interface (maybe cPanel?) - like @vibedesign suggested.
If you want to follow VibeDesigns suggestion (which I recommend) there are some examples on these two pages, and a step-by-step process on the second one:
I have set the site-unavailable-page on another MODx site and put the site-status to NO. In the template, I have added all the HTML and CSS into the MODx site-unavailable-page-template.
This works well for a one-pager website (not sure if the CSS will work unless it is included in the template code.) but in my quick sketch, I hope to take you along into my question about a multiple-page website with all its assets etc. Can I just upload them using (S)FTP and will it all work?
@bobray I have had a quick read of the article, but it looks like it is just above my knowledge base. Too many assumptions of things, the reader knows in order to make it all work. I hope I’ll get some more low-level input to a nice workflow I feel comfortable with.
If your site is in “maintenance-mode”, only you as an admin, if logged into the manager/backend, will be able to see every page. Anonymous users will, even with knowledge of a potential subpage, always see your maintenance page.
It sounds like @uxpascal has more of a multi-page site to display in the meantime - rather than just a single page - so not sure if the Site Status / Site Unavailable Page settings are going to cover that?
What’s your hosting situation @uxpascal ? Is it cPanel?
Actually, I work on different hosting etc platforms. Not my choice, it’s done by the client.
In the meantime i have tested something and it seems to work. Let me take you along this configuration step-by-step. Remember, im not a technical person.
Install MODx.
create (copy) the code for the “maintenance- page” (aka the homepage) and place it in a template.
Create the static html files or upload them via sFTP.
in the system Settings set the Site-status to NO. (if needed set the Site-unavailable-page to the template you have made. (in this example nr2, as shown in step 2.)
A drawback of this solution is, that you can’t now use the same URLs for the new MODX website as you used for the old static HTML site.
A request to www.yourdomain.com/page-two.html will always show the static HTML file. If you create a resource in MODX with the same URL, you can’t test if the page looks correct (without calling the page with the id-parameter or like this → www.yourdomain.com/index.php?q=page-two.html).
@halftrainedharry I did a quick test.
Questions of an overthinker…
I have put the site in maintenance mode and in an incognito browser window it took me to the “offline page”. This works as I imagined it would.
You suggest that this will not let me see the “behind the scenes” development pages. Via the dashboard, I go to a resource page. Let’s say, “homepage”. I can then hit the view button and I see the webpage that would be displayed when the site status is “online”.
Do I overlook something? Because I can still use the online navigation and open other pages while the site is offline.
I was only talking about pages in MODX that have the same URL as an existing static HTML file in the file system.
In your screenshot you have a file in the file system with the name “page-two.html”.
If you now create a MODX page with the alias “page-two” (and Content Type = HTML), you won’t be able to preview that.
If all the pages of your new MODX site have different URLs than the static files of the old site, then there is no problem.