Need help with Apache .htaccess, continued

I have a need to redirect any requested page to /index.html. I did get a solution to this in .htaccess as follows:

RewriteEngine on
 RewriteCond %{REQUEST_URI} !^/index.html$
 RewriteRule .* /index.html [L,R=302]

which almost works. As it turns out, I have image files in the index.html page and with the above .htaccess the images don't show on the page. I assume they are getting rewritten too.

How can I do what I want and preserve the image links? Images are .jpg and .png. Alternatively, I could only rewrite .html and .jsp request to index.html since those are the only pages client users are likely to have cached.

Linux Apache 2.4.10.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MarkAuthor Commented:
I've come up with the following that works:

RewriteRule images/.*.jpg$ - [L]
RewriteRule images/.*.png$ - [L]
RewriteRule images/.*.gif$ - [L]

RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule .* /index.html [L,R]

Can someone simplify this a bit?
Are there other file types in the /images directory?  If you only have images there why not just:

     RewriteRule images/*$ - [L]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarkAuthor Commented:
That did it! Though I used:

RewriteRule images/.*$ - [L]
Steve BinkCommented:
Just for completeness...

To rewrite only html and jsp:
RewriteCond %{REQUEST_URI} !^/index.html$ [NC]
RewriteRule ^.*\.(jsp|html?)$ /index.html [NC,L]

Open in new window

An alternative way to not rewrite images:
RewriteCond %{REQUEST_URI} !\.(png|jpg)$ [NC]
RewriteCond %{REQUEST_URI} !^/index.html$ [NC]
RewriteRule ^.*\.(jsp|html?)$ /index.html [NC,L]

Open in new window

Also, remember to use the [NC] modifier on your rules where reasonable.
MarkAuthor Commented:
Thanks! I'll keep these tip!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.