Reputation:
I have this redirect set to redirect all pages to the maintenance page:
RewriteCond %{REQUEST_URI} !/maintenance.php$
RewriteRule $ /maintenance.php [L]
However, it's not loading the CSS (located in /assets/css/stylesheet.css
). How can I have it load the CSS?
Upvotes: 1
Views: 426
Reputation: 19016
That's a weird way of thinking but here's a solution for your example
RewriteCond %{REQUEST_URI} !^/(?:assets/css/|maintenance\.php$) [NC]
RewriteRule ^ /maintenance.php [L]
Note: you should not do it that way (bad for search engines indexing pages when you're on maintenance)
A better way of doing it (following your idea) is to send a 503
HTTP code to tell crawlers/users your site is under maintenance
RewriteCond %{REQUEST_URI} !^/(?:assets/css/|maintenance\.php$) [NC]
RewriteRule ^ /maintenance.php [R=503,L]
Upvotes: 2