Many developers face this scenario: an old Joomla site still running on LAMP stack, consuming server resources for content that hasn't changed in years. The MySQL database becomes unnecessary overhead when dealing with completely static content.
Static sites offer significant advantages:
- Zero database dependencies
- Improved security (no PHP execution)
- Reduced server resource usage
- Simplified hosting (can deploy to CDNs like Netlify)
Here are the most effective tools for this conversion:
# Using wget (most universal solution)
wget \
--mirror \
--convert-links \
--adjust-extension \
--page-requisites \
--no-parent \
--wait=1 \
--limit-rate=100k \
--random-wait \
http://yourjoomlasite.com
For complex Joomla sites, you might need additional parameters:
# Extended wget command for JS-heavy sites
wget \
--execute robots=off \
--span-hosts \
--domains yourjoomlasite.com,cdn.domain.com \
--reject-regex "(.*)\?(.*)" \
--header="Accept: text/html" \
--user-agent="Mozilla/5.0" \
--recursive --level=5
Joomla often requires special handling for:
- SEO URLs that might break during conversion
- AJAX calls that need to be excluded
- Form submissions that should be removed
- Dynamic menus that require static alternatives
While wget works well, other options exist:
# Using httrack (alternative to wget)
httrack http://yourjoomlasite.com \
-O ./static_site \
--mirror \
--disable-security-limits \
--max-rate=100000 \
--keep-alive \
--depth=10
After crawling, consider these clean-up actions:
# Remove unnecessary files
find . -type f -name "*.php" -delete
find . -type f -name "*.orig" -delete
# Fix any remaining dynamic links
sed -i 's/?.*"/"/g' *.html
Test the static version thoroughly before going live:
- Check all internal links
- Verify form replacements (if any)
- Test search functionality alternatives
- Validate all media assets loaded properly
Even static sites need some oversight:
- Set up broken link monitoring
- Implement basic security headers
- Configure proper caching
- Monitor for unexpected traffic patterns
Maintaining legacy Joomla installations creates unnecessary overhead when content becomes static. The MySQL database backend, PHP processing, and security updates become liabilities for archived sites that no longer require dynamic functionality.
Several robust tools exist for converting dynamic sites to static HTML:
# Using wget for basic mirroring
wget --mirror --convert-links --adjust-extension --page-requisites \\
--no-parent --output-file=log.txt https://example.com
# HTTrack example with more options
httrack https://example.com -O ./static_site --mirror --robots=0 \\
--user-agent "Mozilla/5.0" --keep-alive --verbose
For complex sites requiring custom processing:
import scrapy
class StaticSiteSpider(scrapy.Spider):
name = 'static_converter'
start_urls = ['https://example.com']
custom_settings = {
'DEPTH_LIMIT': 5,
'CONCURRENT_REQUESTS': 8,
'AUTOTHROTTLE_ENABLED': True
}
def parse(self, response):
filename = response.url.split("/")[-1] or 'index.html'
with open(f'output/{filename}', 'wb') as f:
f.write(response.body)
for link in response.css('a::attr(href)').getall():
yield response.follow(link, self.parse)
- Fix absolute paths with sed:
sed -i 's/https:\/\/example.com\///g' *.html
- Remove tracking scripts and dynamic elements
- Compress images with ImageMagick or similar tools
The static output can be deployed to:
- Netlify (free tier available)
- GitHub Pages
- S3 bucket with CloudFront
- Traditional web hosting