Code Snippet </> Info
Snippet Name: Server Maintenance Redirection
Description: This code makes it easy to temporarily take down a website for updates.
You will need to know your IP Address so that you are able to view your website while all others are redirected.
Note: Replace the "555" line with your own IP address so that you'll still be able to view the website as normal while everyone else gets redirected. Images and styles are allowed to pass through the filter as well.
Create a page file named 'maintenance.html' or rename the file name path in the code snippet.
Author:
Last Modified: 2015-12-14 05:38:41
Language: .htaccess
Highlight Mode: html
|
Copy Codes: Use Free Notepad ++ |
|
Snap HTML Code Editor: Paste the source code, make changes and instantly see it in live preview. Snap HTML Code Editor
|
|
Copied To Clipboard!
#Begin Server Maintenance Redirection
RewriteEngine on
RewriteCond %{REQUEST_URI} !maintenance.html
RewriteCond %{REQUEST_FILENAME} !(styles|images).+$
# Replace 555\.555\.555\.555 with your own IP address
RewriteCond %{REMOTE_ADDR} !^555\.555\.555\.555$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteRule (.*) /maintenance.html [R,L]
# // --> End
|