0

I'm running on an Ubuntu 13.10 dev environment with Apache2 and after hours of trying to figure out permission errors to access routes, I was able to fix it. Now I can successfully browse through my application, but the problem that now exists is that I cannot access my css/js files within my public directory - it kicks back with a 403.

I've tried modifying the .htaccess file, the virtual host config file, and ran chmod on the entire site directory.

Here's a copy of my .htaccess file within the Public folder:

    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

And here's a copy of my virtual host file:

<VirtualHost *:80>
DocumentRoot "/home/casey/Sites/caseyhoffmann.me/public"
ServerName caseyhoffmann.me.dev
<Directory "/home/casey/Sites/caseyhoffmann.me/public/">
    AllowOverride all
    Require all granted
    DirectoryIndex index.php index.html
    Options -MultiViews
</Directory>
</VirtualHost>

Any ideas?

2 Answers 2

4

Solved. Reapplied chown and redid chmod on the directory. File system permissions issue and had nothing to do with Apache.

Sign up to request clarification or add additional context in comments.

1 Comment

If you notice what were the correct permissions, it will be helpful to others.
1

Solution 1: (Recommended)

use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /.

Solution 2:

You can try adding this in your page's header:

<base href="/" />

3 Comments

I'm using Laravel's HTML helper class which outputs the absolute path: HTML::style('css/bootstrap-flatly.min.css') This translates into this: <link media="all" type="text/css" rel="stylesheet" href="localhost/css/bootstrap-flatly.min.css"> in the source.
In that case css URL won't be impacted since you have RewriteCond %{REQUEST_FILENAME} !-f in your rule.
So you're saying that I shouldn't use that? I'm a bit confused.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.