Learn in this tutorial how to generate a maintenance page and redirect your WordPress website URL to it using a simple code snippet.
Do you ever have to make a quick change to the web but don’t feel like installing and uninstalling a “Coming soon” plugin or similar?
Sometimes you just need to make small changes that won’t take long. However, you also don’t want the website to be visible while you make them.
You can do this by adding a snippet to the functions.php of the Genesis child themes.
But, what if you’re going to make changes that affect the child theme?
In that case you need to create a custom maintenance page to be displayed while you make changes to the child theme.
Are you ready? Here we go.
Steps to set up a custom maintenance page
1. Create an html file.
Generate a file with a name maintenance.html (for example), that shows the ‘Closed for work’ message you want:
To see this and another 917 code snippets of this website, login or subscribe here.
This is just a simple example, but you can modify the text as you prefer, add a contact email and even insert a background image.
2. Modify the .htaccess file
Enter the following snippet at the beginning of the .htaccess file:
To see this and another 917 code snippets of this website, login or subscribe here.
This redirects all visits on your website to the maintenance page.
This would be the final result:

And once you’re done with the changes, remove the lines of code from .htaccess and that’s it.
Conclusion
As you can see, with a few lines of code you can get your website into maintenance mode with a custom message without the need to use third party plugins.
You only need to create a small page to which you can redirect your website during the ‘works’.
This trick is as simple as it is practical for WordPress designers and developers. Personally, it works great for me. I hope you find it useful too.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉