WebFaction
Community site: login faq

I have a Static/PHP/CGI site located at:

[subdomain].[username].webfactional.com.

I added a mod_wsgi application and in control panel made it available at this url:

[subdomain].[username].webfactional.com/actions

After having done this, the htaccess directive for replacing missing images is being invoked, even when the image is where it should be with the proper permissions set. The src attributes for the images are all like this:

/assets/movies/[movie-name]/thumb1.jpg.

The file, assets/movies/.htaccess reads as follows:

RewriteEngine on 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f 
RewriteRule thumb1.jpg /assets/movies/transparent-thumb.gif [NC,L]

Everything was working fine before I added the mod_wsgi application. Any ideas on what's going on here and how it might be fixed?

Thanks.

Mike

asked 24 Mar '14, 05:16

mikegirard
213
accept rate: 0%

edited 24 Mar '14, 05:23


Webfaction's Ryan S provided the solution, a modified version of which is below:

When more than one application is mounted on a website record, the DOCUMENT_ROOT is no longer definitive since before URL Path resolution it's unknown which application the request will eventually be passed on to. In that case, DOCUMENT_ROOT becomes "/home/[username]/webapps/_" -- a useless, nonexistent directory. So, if you're relying on %{DOCUMENT_ROOT} in your .htaccess file, it will look like every file no longer exists, and therefore will perform the rewrite to the placeholder gif.

The correct approach is to not rely on %{DOCUMENT_ROOT} for any application which will be mounted with more than one URL Path component on the corresponding website record. Replace %{DOCUMENT_ROOT} with "/home/username/webapps/[site_root]" and see if this corrects the issue.

permanent link

answered 24 Mar '14, 11:49

mikegirard
213
accept rate: 0%

edited 24 Mar '14, 11:51

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×75
×55
×27

question asked: 24 Mar '14, 05:16

question was seen: 1,704 times

last updated: 24 Mar '14, 11:51

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM