Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

.htaccess vs. vhost.conf [solved]


Go to End


827 Views

Avatar
digibrains

Community Member, 130 Posts

28 February 2016 at 5:55am

Edited: 01/03/2016 7:19pm

Does SS require .htaccess files? Can I not put all the directive directly in a vhost.conf file?

The site itself works when I do this, but I'm getting 404 errors on include files like .css and .js.

If .conf files do work, does anyone have an example? Seems like I'm missing something simple here.

This is what I have in my .conf file:

# Process through SilverStripe if no file with the requested name exists.
# Pass through the original path as a query parameter, and retain the existing parameters.
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* %{DOCUMENT_ROOT}/framework/main.php?url=%1 [QSA]

EDIT: I was missing something simple. Totally forgot to wrap these statements in <Directory /path/to/root>...</Directory> tags. Works like a charm!