Forum Moderators: phranque

Message Too Old, No Replies

This should be simple :RewriteCond

         

mxfun

6:17 am on Sep 21, 2009 (gmt 0)

10+ Year Member



Hi,

I've been trying to set up a rewrite rule, that I can load in while I upgrade the site behind. I've been trying to get this to work:


RewriteEngine on
RewriteCond %{REQUEST_URI} !^.*(/maintenance_files/¦\.js¦\.css¦\.png¦\.jpg).*$ [NC,OR]
RewriteCond %{REQUEST_URI} !/maintenance\.html$
RewriteRule ^(.*)$ /maintenance.html [L]

Basically I was all requests to show the maintenance.html file, except for any css, images that come fom the /maintenance_file dir (which are used to style the maintenance.html

jdMorgan

12:26 pm on Sep 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The opening parenthese appears to have been mis-located and the use of [OR] in the case of two negative match patterns is incorrect. Fixing that and some other minor redundancy and anchoring problems yields:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/maintenance_files/.+\.(js¦css¦png¦jpg)$
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^ /maintenance.html [L]

Replace the broken pipe "¦" characters with solid pipes before use; Posting on this forum modifies the pipe characters.

Jim

mxfun

5:34 am on Sep 22, 2009 (gmt 0)

10+ Year Member



Hi Jim,

thanks for your help on this is much appreciated.

I have tried this but it still does not work. The css and images are returning 404. Not sure how to proceed from here.

mxfun

12:41 pm on Sep 22, 2009 (gmt 0)

10+ Year Member



Ah I figured it out. I still had some proxy path routing to a tomcat instance. My bad.
thx