Reputation: 33
I would like to know how I can install an under maintenance template to my site. It contains this files and folder:
I have used the code below in my .htaccess
file to redirect to the index.html
, but it only shows the html content.
RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.html$
RewriteCond %{REMOTE_ADDR} !^123.123.123.123
RewriteRule $ /index.html [R=302,L]
How can I pull the images and CSS I have in the other folders?
Upvotes: 0
Views: 147
Reputation: 26066
Try this instead:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteCond %{REMOTE_ADDR} !=123.123.123.123
RewriteRule ^(images|tools)($|/) - [L]
RewriteRule ^(.*)$ /maintenance.html [NC,L,R=302]
This will ignore the images
& tools
directory but redirect all content to /maintenance.html
. I also adjusted the format of the REQUEST_URI
URL as well as the REMOTE_ADDR
check.
Upvotes: 2