Skip to content

Instantly share code, notes, and snippets.

@crofty
Created September 9, 2009 07:24
Show Gist options
  • Save crofty/183537 to your computer and use it in GitHub Desktop.
Save crofty/183537 to your computer and use it in GitHub Desktop.
Apache URL rewrite
# Enabling URL rewriting with apache
sudo a2enmod rewrite
# Edit /etc/apache2/apache2.conf
RewriteEngine On
# Edit the vhosts in /etc/apache2/sites-available. e.g.
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://www.domain.com$1 [R=301,L]
DocumentRoot /var/www/apps/app/current/public
</VirtualHost>
# Restart Apache
sudo /etc/init.d/apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment