You need to qualify the path to your image in your HTML (or CSS):
<!-- This will break in the way you describe -->
<img src="static/images/volume.png" />
<!-- This will not -->
<img src="/static/images/volume.png" />
<!-- Nor will this (assuming you are using a Jinja template) -->
<img src="{{ url_for('static', filename='images/volume.png') }}" />
The reason for this is because of the way that user-agents are required to resolve relative paths for URIs (see section 5.1 of RFC 3968 for the details).
Using static/images/volume.png
results in the following path at /
:
scheme://host.name/static/images/volume.png
and the following at /s
:
scheme://host.name/s/static/images/volume.png
as you have discovered. By ensuring that you provide an absolute path
component (at the very least) for your resources, you ensure that the browser will merge your provided path with only scheme
and host.name
, rather than with scheme
, host.name
and path
.