WordPress (or any CMS) to html files
Can you host a website made in WordPress on IIS? Or one made in DotNetNuke on Apache? Yes! Now I am NOT about the describe how you can run those application where they weren't meant to run. I'll just show you how you can have a CMS spit out plain html files - no need for database or server-side scripting.
Yes, I'm probably crazy - I understand that situations where this would be applicable are only a few. That's because my "solution" will work well (without additional labor) only for "static" websites - no forms (including contact/comment forms). I'll list a few applicable situations at the bottom of this post.
- Let's say you created the website and set it up under http://localhost/mywebsite. (If it is WordPress, you may need to change the relative references in your theme's css to absolute)
- In your Linux terminal or Cygwin on your Windows machine, run the following wget command:
wget --html-extension --recursive --page-requisites --progress=bar --mirror http://localhost/mywebsiteThis will generate an html file for every page of your website.
- Once you have all the files, you will want to mass find-and-replace all instances of localhost/mywebsite to e.g. www.andrejciho.com. The script below is a powerful one. It finds and replace stuff inside of all files under a folder, no matter how deep inside the directory structure:
find . -type f -exec sed -i 's/localhost\\/mywebsite/www.andrejciho.com/g' {} \\;
Possible applicable situations:
- University IT department gives a student government FrontPage access to a folder on their server, but no database access. The student government folks are good with WordPress.
- Your client demands that you migrate the website you made for them in WordPress to their IIS server.
- You want your server to exert as little energy as possible when serving your website.
Leave a Comment