-
Notifications
You must be signed in to change notification settings - Fork 482
Apache
Getting Backbone Boilerplate to work with the Apache2 web server is very easy.
Once you have configured your main Apache configuration (eg
/etc/apache2/httpd.conf
) to point to your web application, you will need to
include an .htaccess
file. This file contains the necessary redirection for
using the HTML5 History API (pushState) and the release distribution assets.
The .htaccess
file should live in the root of your project and look something
like this:
# Remove the trailing slash from routes
DirectorySlash Off
# Enable the RewriteEngine
RewriteEngine on
# Map resources to development
RewriteRule ^app/(.*)$ app/$1 [NC,L]
RewriteRule ^vendor/(.*)$ vendor/$1 [NC,L]
# These conditions ensure that the file does not exist and that the current
# request URI is not the index.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index
# Redirect remaining requests to the index.html file
RewriteRule (.*) index.html [NC,L]
A release configuration file that includes proper mappings looks like:
# Remove the trailing slash from routes
DirectorySlash Off
# Enable the RewriteEngine
RewriteEngine on
# Map resources to release distribution
RewriteRule ^app/(.*)$ dist/release/$1 [NC,L]
RewriteRule ^source.js$ dist/release/source.js [NC,L]
RewriteRule ^app/styles/index.css$ dist/release/app/styles/index.css [NC,L]
# These conditions ensure that the file does not exist and that the current
# request URI is not the index.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index
# Redirect remaining requests to the index.html file
RewriteRule (.*) index.html [NC,L]
Once this has been created you can use bbb release
to build your application
and deploy. A good development flow may be to develop using the bbb server
command (which uses raw resources) and to commit your .htaccess
file with the
project for deployment.
Getting started
Configuration
How to structure
Build process
Deployment options
Testing
Miscellaneous