testing
testing

Reputation: 20279

Imagepath like /images/john works but on another server not

I made a transfer of a CMS from one server to another. On the new server an image was not found. I looked in the HTML code and saw

<img src="/images/john" alt="john" />

The picture had no extension like *.jpg. But why did it work on the old server? It is the same code, same database and same htaccess file. Even Internet Explorer can find the picture.

Is an Apache or PHP configuration responsible for that behavior? I only want to find out why.

Upvotes: 0

Views: 77

Answers (1)

meustrus
meustrus

Reputation: 7315

Is it possible that MultiViews is enabled on the old server but not on the new one? MultiViews is an Apache feature that lets you query for files without including the extension (so images/john might return the file at images/john.jpg). It is intended (as far as I'm aware) to allow you to have multiple versions of the same page, with the ultimate version picked depending on the user's locale; a browser requesting index from Spain might get index.es.php while in Japan it might get index.jp.php. I've never used this feature myself, so I don't know if that's the correct usage to serve locale-dependent pages, but I do know that MultiViews has the side effect of serving index.php in response to index.

Note that MultiViews is controlled by the Options directive, and it is the only such option that is not included in All. So to get all options including MultiViews, you would need Options All MultiViews in your .htaccess file. This may or may not enable MultiViews depending on the Allow Override directive in Apache's configuration for your directory; if you're on shared hosting there's nothing you can do but complain (although they tend to allow all .htaccess overrides to avoid such complaints).

Upvotes: 1

Related Questions