WebFaction
Community site: login faq

Hi there,

I'm stuck and could really use some help. I'm using Agavi PHP framework which kindly generates a .htaccess file for you during setup. The .htaccess file works fine (with minor change to RewriteBase) on my local copy, but since I've uploaded it to webfaction I've not been able to load any static files. Example directory structure:

app_dir/
    public_dir/
        static_dir/
            image/
            stylesheets/
        index.php
        .htaccess
    private_dir1/
    private_dir2/

The actual application is in it's own folder in /home/{me}/app_dir. I created a "symbolic link to php" app in the webfaction control panel which points to /home/{me}/appdir/public_dir, then created a website using the symbolic app. The website loads fine in that it presents all the information I'd expect - the app itself works, but none of the styles or images load. When I try to go www.mydomain.com/static_dir/stylesheets/style.css I find the path is being routed through the index.php (and therefore the application goes looking for that controller).

I'm sure it's a problem with my .htaccess file but server configuration isn't my greatest strength. It does seem like the rules within the if statement aren't being applied at all.

DirectoryIndex index.php
Options -MultiViews -Indexes +FollowSymLinks

AcceptPathInfo On
DirectorySlash Off

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index.php.*$ ./index.php?/$0 [NC,QSA,L]
    # If the requested URL doesn't exist, let Agavi handle it
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php?/$1 [QSA,L]
</IfModule>

Any help with this would be greatly appreciated as I've wasted many hours on it already.

Thanks

asked 14 Nov '11, 16:51

lblack
312
accept rate: 0%


I took a look at your account directly, and I think its a capitol letter in one of the paths.

Some of the rewrites are working, if you look at the source code being rendered by the browser your JavaScript is working, but the CSS is not. When I looked at the path on the disk directly I noticed there is a directory named 'Default' , where as the URL is /default/. If you change the URLs to /Default/ in the browser directly those files load. So try renaming /styles/Default to /styles/default.

permanent link

answered 14 Nov '11, 17:23

johns
5.4k412
accept rate: 23%

Johns, thanks so much!

There's a good chance I would have spent more hours on this issue if you hadn't pointed out the folder name. I actually deleted that folder a couple of weeks ago and created the new version with a lower case 'd' (so I wouldn't have these types of problems). Somehow it remained in svn. Never would have expected it.

Plus, initially none of the static files were loading, including the js, so through the many iterations over the site setup and .htaccess, I must have fixed the original problem without realising, but seeing apparently the same results (no style loaded), thought nothing had changed.

Fresh set of eyes can make all the difference. Thanks again!

lblack

(15 Nov '11, 04:10) lblack
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:

×265
×22
×2

question asked: 14 Nov '11, 16:51

question was seen: 4,583 times

last updated: 15 Nov '11, 04:10

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 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