How did that go and any positives from going html?
Turning WP blogs into HTML
-
antisocial
- Verified Member

- Posts: 401
- Joined: November 18th, 2019, 2:05 am
- Contact:
-
LovinLife
- Verified Member

- Posts: 205
- Joined: March 20th, 2023, 3:48 pm
It makes no sense to dump WP and go html, tighten your permissions, update all plugins and be happy.
- tacnet
- Board Sponsor

- Posts: 3634
- Joined: February 22nd, 2019, 7:21 pm
- Referrals: 9
- Contact:
What are you talking about ???? You completely missed the point. Nobody is saying dump WP......WP IS HTML !
WP is a CMS system. Its the back end that produces your web pages. Once you start getting a lot of traffic (either via bots or just normal growth) then you need to consider producing those pages on a scheduled basis (eg every few minutes) rather than each time the page loads (which could be 1000s of times a minute). You STILL carry on using WP, you simply reduce the load it places on your servers by scheduling when it runs.
Try running native WP when your site gets over 200k hits a day
This is a standard technique that big sites use to scale up for high traffic. We've been doing it for years
- BOB777
- Verified Member

- Posts: 980
- Joined: September 20th, 2018, 4:24 am
- tacnet
- Board Sponsor

- Posts: 3634
- Joined: February 22nd, 2019, 7:21 pm
- Referrals: 9
- Contact:
Ive had a couple of questions about this so I thought I would knock up a quick step by step example of how to write your WP (or any script) pages to static HTML files using a cron job. A cron job is simply a scheduled task that you can setup to run repeatedly and as often as you like
Generally you would use this for your high traffic pages so instead of your script having to run maybe 1000s of times a minute, you can set it to run once every say 5 minutes and save the output to static html files. That massively reduces your server load
That's it. Hope somebody finds that useful
Generally you would use this for your high traffic pages so instead of your script having to run maybe 1000s of times a minute, you can set it to run once every say 5 minutes and save the output to static html files. That massively reduces your server load
- 1. Copy the code below and save it to a file called html_cron.php. Change the URL's and filenames as appropriate for your site. You can write as many pages as you like
- 2. Upload it to somewhere on your server and CHMOD it to 755. You can test the script is working by opening it in your browser
- 3. You can easily setup the cron job in c-panel. See https://www.kualo.com/knowledgebase/cpa ... -in-cpanel
The cron command will be something like this :-
*/5 * * * * /usr/local/bin/php /home/youruser/public_html/path/to/html_cron.php >/dev/null 2>&1
That will run the cron script every 5 minutes and update the html pages. The >/dev/null 2>&1 simply discards the output
- Now update your .htaccess file to re-direct your script page(s) to the html file(s)
RewriteEngine On
RewriteRule ^path/to/my/url$ /path/to/html_file.html [NC,L]
Code: Select all
<?php
// Simple write URL to html cron script
function write_page($url, $filename) {
$html = file_get_contents($url);
if (strlen($html) > 0) {
$handle = fopen($filename,"w");
fwrite($handle,$html);
fclose($handle);
print "Saved <a href='$url'>$url</a> to <a href='$filename'>$filename</a><br>";
}
else { print "Could not read $url<br>"; }
}
// Below you can call the function as many times as you like in the format
// write_page('url_to_read', 'filename.html');
// For example :-
write_page('https://www.sponsorchat.com/', 'main_index.html');
// You can also add a relative path to the filename
write_page('https://www.sponsorchat.com/viewforum.php?f=74', 'html_pages/topic_list.html');
?>-
greatpornlinks
- Verified Member

- Posts: 1710
- Joined: June 14th, 2018, 6:51 pm
tacnet wrote: ↑August 11th, 2026, 10:10 pmIts very easy to setup a cron job to read your high traffic pages and store them as static html, say every minute.
Then its simply a case of using .htaccess to redirect links to those static html files
Its a standard scaling up technique that we've been using for years
This can save me so much trouble with bots hitting php files on my blogs, I will give it a shot and report back once I get things underway.
I won't hijack your thread with my next comment, I'll start a new thread.
Never have your honey where you make your money.
~ HeidiHoe 2023
~ HeidiHoe 2023
- AlexO
- Verified Member

- Posts: 6390
- Joined: February 10th, 2018, 5:37 pm
- Title: I like Celebrities
This is a very good idea going to try it out on one of my blogs see if it affects speed.
Give me celebrity porn 
- gotonudecom
- Verified Member

- Posts: 3168
- Joined: February 6th, 2018, 1:54 pm
- Title: DomainMaster
- Referrals: 30
- Contact:
Bikker installed a great cache plugin that greatly reduced the impact on our database.
He also set the server firewall to block hits that come in to fast from a single IP.
When the bots hit our servers, too fast, they get blocked.
Another test we did included converting the database to json files and now the HTML is created from those files. That did become an issue on the really big sites as it takes so long to update all the json files at once.
we are working on updating the json files one at a time, only when a page is created or updated. Also adding excluding any pages that need to remain dynamic.
This is not a WP responsibility to deal with. this is a server responsibility.
WP is a CMS not a server security system.
-
BrentG
- Verified Member

- Posts: 380
- Joined: September 28th, 2019, 7:35 am
-
Kosta
- Verified Member

- Posts: 273
- Joined: April 11th, 2023, 1:56 pm
- tacnet
- Board Sponsor

- Posts: 3634
- Joined: February 22nd, 2019, 7:21 pm
- Referrals: 9
- Contact:
Nope. You can set a cron job to update your pages every minute if you like meaning WP (or whatever back end script you use) will only run a maximum of once a minute, regardless of how many hits its getting
And if you don't have c-panel, then you can use the "crontab -e" command. See https://uptimerobot.com/knowledge-hub/c ... ab-safely/
Example cron job to run every minute :-
* * * * * /usr/local/bin/php /home/youruser/public_html/path/to/html_cron.php >/dev/null 2>&1
The stars equate to minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-6)
We've been doing this for years
- gspotman
- Verified Member

- Posts: 1412
- Joined: June 6th, 2018, 7:42 pm
There are plugins to turn WP into a html based site, the problem is you can not add new categories and posts to the html version once you create it.
Teams: 60c094411cbb39b8
Email: gspotman@gmx.com
Email: gspotman@gmx.com
- tacnet
- Board Sponsor

- Posts: 3634
- Joined: February 22nd, 2019, 7:21 pm
- Referrals: 9
- Contact:
I thought there might be a plugin to do this but Im surprised you cant update it ?. An html file is no different to any other file and can be updated as often as you like
Still, the solution above will work with WP and pretty much any other CMS script
- gotonudecom
- Verified Member

- Posts: 3168
- Joined: February 6th, 2018, 1:54 pm
- Title: DomainMaster
- Referrals: 30
- Contact:
@tacnet
Have you experience or heard of exporting the WP database into json files and using python to create the static pages of the site?
- tacnet
- Board Sponsor

- Posts: 3634
- Joined: February 22nd, 2019, 7:21 pm
- Referrals: 9
- Contact:
That's one way of doing it but it seems a bit over complicated. That little script I posted above will take whatever output WP produces and write it straight to an html file. No export or json files neededgotonudecom wrote: ↑September 23rd, 2026, 11:57 am@tacnet
Have you experience or heard of exporting the WP database into json files and using python to create the static pages of the site?