I’m trying out WP2Static. I have Version 6.6.7.
When I try to generate my static site, I get the message “Analyzing site… this may take a few minutes (but it’s worth it!)”. So I wait and wait and after 17 hours it’s still displaying that message and no output has been produced. WP2Static hasn’t even created its output directory . Am I correct thinking that WP2Static has hung?
My blog (boostapps.com) has around 900 posts and 1200 comments and is running on shared hosting from Pair networks. WordPress version is 5.5 and PHP version is 7.1.22.
How can I troubleshoot the issue? There are no errors in the logs, just long lists of some of the site’s files.
How can I kill the hung process so I can retry the export? The “Start static site export” “Save current options” and “Reset to default settings” buttons on the WP2Static
UI are grayed out and disabled and I can’t find anyway to cancel the hung export
Shouldn’t take too long.
Please deactivate and delete that copy and install this:
You’ll note the plugin’s name is changed to Static HTML Output here, but it’s the latest version of the plugin you’ve been using.
Please let me know if that does any better. It has built in logs which may surface an issue.
Thanks for your quick reply. I’ve installed the updated plugin but I don’t see how I can use it to do what I need. I want to replace my current dynamic site with the new static site on the same URL. So I’d like to export the static files to a directory and then change the domain mapping to point to the new static directory.
The old plugin had options to create the static site with relative URLs and to create in a directory on my server. The new pluing doesn’t seem to have either option.
I thought about using the deploy to a .zip option and then unzipping into my desired directory. But when I choose the zip option the plugin warns not to specify my current site’s URL as the destination URL and won’t allow me to specify / to create relative URLs either.
Is there some way to use this plugin to create a static site in a directory with relative URLs so that it can work on the same URL?
I’ve removed the folder deployment option, but you can still grab the files out from the wp-contents/uploads/ directory after export completes.
Same URL isn’t really supported and recommended to have a separate dev server, with no public access.
zip deploy should also work fine.
If you only have one hosting account / unable to have extra subdomains, you may consider keeping your dev site on your local computer, then upload the exported site to your current hosting or drag and drop the zip to Netlify for free and kill the old hosting.
Many approaches that should work, please let me know if need more ideas.
Thanks, creating subdomains is not the issue for me. I can create unlimited subdomains. But I want the existing site to stay up at boostapps.com while I’m exporting and testing the static site and then change the server mappings to point to the new static site directory without changing the site URL or breaking any internal or external inks.
I also like the links rewritten as protocol relative //boostapps.com without http: or https: so that they will work with or without https.
BTW, I ran a test outputting to a zip with a dummy URL and it ran quickly and as far as I can tell correctly. Now I just need to find a way to run it with protocol
relative links using my current WordPress URL.
Sorry, you seem to be getting unlucky with desiring what I keep removing from the project!
Protocol-relative rewrites are also out of scope - basically, there are cases where rewriting to protocol-relative URLs leads to invalid HTML and broken links and would lock into the plugin requiring more closely following changes to HTML specifications to stay current.
You can still do this yourself during your workflow, using simple rewriting script against the output site files or hook into the plugin to do it with some PHP code in your theme’s functions.php, for example. Let me know if you need help with that, it’s the kind of thing we should have more tutorials on.
Re testing the site out before switching over - it’s a choice for you on how much effort you want vs risk of issues when deploying to live site.
ie, I’d add in a staging server and use it to test every deployment, not just the first switch over:
When first switching over a site, if staging.mysite.com is looking good, that should be enough, but you do have a subdomain vs naked domain (if not using www.), so could even use an alternate naked domain for a more “production-like” test.
If that’s not a justifiable effort to do each time, then adjusting your local computer’s
/etc/hosts file to resolve boostapps.com to
DEV_SERVER_IP may be enough for you to test rewrites to the live site’s domain just for requests from your computer, while public visitors still get your existing live WP site. (Just beware in case your browser has done the recent switch to DNS over Https, I’m not sure if they still respect your hosts file)
Thanks for your help and for your work creating this plugin. I will experiment with deployment strategies and with using a shell script with sed to replace the URLs in the static site files.