Forum Moderators: phranque
I'm trying to redirect all traffic for our site when we do a maintence load. I've been struggeling with this for a week or so now.
If for example I access the site like this : [mysite.com...]
the maintence page shows perfectly. However if I access the site like :
[mysite.com...]
the page is displayed but all the css and images are not displayed due to the relative path issue.
Here's my rewrite:
Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/maintenance_files/.+\.(js¦css¦png¦jpg)$
RewriteCond %{REQUEST_URI} !^/.+\.(js¦css¦png¦jpg)$
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^ /maintenance.html [L]
DocumentRoot "/data/mysite/public"
any pointers would be most welcome.
thanks
Do the same for the .css and .js includes.
Changing your mod_rewrite code really can't help, since it is the browser that resolves relative links, and in this case, it will resolve them based on the "directory-level" in the originally-requested URI, not the rewritten one.
Another option here would be to redirect the client to the maintenance page instead of using an internal rewrite.
And the best option would be to have an "A" and "B" copy of your site, do all updates and testing on "B", and then switch "A" with "B" only when ready to deploy the new version, avoiding this "maintenance" problem completely.
You can also simplify your first RewriteCond pattern to just "!^/maintenance_files/" since the excluded filetype pattern is redundant with your second rewritecond.
Jim
[edited by: jdMorgan at 4:02 pm (utc) on Nov. 16, 2009]