Slash-started resources redirection in HTML with .htaccess

Posted by Pawka on Server Fault See other posts from Server Fault or by Pawka
Published on 2010-05-13T13:22:54Z Indexed on 2010/05/13 13:34 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I have moved old version of webpage to some subdirectory: http://www.smth.com/old/. But all resources (images, css, etc.) in HTML are linked with slash symbol at the start. So browser still tries to load them from root path.

For example old/test.html contains:

<img src="/images/lma_logo.ico" /> <!-- not working !-->

<img src="images/lma_logo.ico" /> <!-- working !-->

How can I rewrite ulrs to load resources from the "old" dir if urls still starts with "/"?

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite