Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange problem resolving paths (affecting mod_rewrite)

Status
Not open for further replies.

richcon

Programmer
Jan 25, 2007
5
US
If the following file exists:

/app/foo/bar.jpg

and the user goes to the URL:

/app/foo/bar/

The 404 Not Found page that results shows:

Not Found
The requested URL /app/foo/bar.jpg/ was not found on this server.

This is effecting my app, because I have an mod_rewrite rule in my .htaccess file that launches a web app if the given filename doesn't exist. But in the above case the rule breaks down and the app never launches, as if mod_rewrite thinks the path exists when it doesn't. Instead I get the above 404 Not Found page. (Following is the mod_rewrite code:)

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* (Launch my web app)

This problem only happens if the existing file's extension is of a filetype Apache knows. It doesn't happen if the file is renamed from bar.jpg to bar.xxx.

Any ideas what's going on here?
 
Solved!

The problem was with Apache's content negotiation. Adding the following line to my .htaccess fixed it:

Code:
Options -MultiViews
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top