Need help with rewrite rule

Hi,

I hosted my site on Apache web server.
I wanted to redirect all the users request to a HTML page(maintenance page).
I used the below rewrite rule to do ths same.

RewriteEngine on
RewriteRule .* /maintenance.html

The maintenance.html page contains an image.
When ever I try to access my site(during maintenance),I am being redirected to the maintenance.html page.But, I am unable to see the image.
Any help would be grateful.....

Thanks,
Srikanth Bodakunta

I suspect your image is being rewritten to /maintenance.html
Quick fix would be to exclude the maintenance page images from the rewrite eg:

RewriteRule !(/images/mtce.jpg|/images/logo.gif)  /maintenance.html

I have tried using the rewite rule you have suggested.But, it still does not work.

I actually wanted all requests to be redirected to the maintenace.html,except the image that I have tried using in the maintenace.html.

Below is the Rewrite rule

 
RewriteEngine on
RewriteRule !(/images/image.jpg) /maintenance.html
RewriteRule .* /maintenance.html

Thanks,
Srikanth Bodakunta.

---------- Post updated at 11:13 PM ---------- Previous update was at 05:42 PM ----------

The below rewrite condition worked for me.....

RewriteCond %{REQUEST_URI} !^/image.jpg  
RewrtiteRule ^/.* /maintenance.html

Thanks a lot.....

1 Like