How to enable Mod_Rewrite in Apache2 on Ubuntu
Was just doing this, and thought it’d be a nice guide to write up.
I’m assuming you already have Apache2 installed on your machine. If not, check how to install Apache 2 on Ubuntu.
Mod_rewrite is a module that allows runtime modification of the URL structure. Typically this is to allow .htaccess directives to implement friendly URLs. This is done frequently in WordPress and many other CMSes.
Link to the Module
Apache 2 on Ubuntu is a bit different than some servers, as Apache is usually controlled in the /etc/apache2 directory.
There will be 2 directories for enabling mods, they are /etc/apache2/mods-enabled and /etc/apache2/mods-available. Mods-enabled includes a list (hopefully links) of files that are enabled via the configuration file (if you look, there’s a command to load all modules in that directory). Mods-available, is all modules you can enable.
To create the link:
cd /etc/apache2/modes-enabled
ln-s ../mods-available/rewrite.load rewrite.load
That’s ready …
Allow Mod Rewrite
Once you have the module “Enabled” (not yet since we didn’t restart apache, but essentially enabled), you need to let your instance override.
If you go to your /etc/apache2/sites-available folder you can edit the configuration of your site, if not you can do default (this example assumes “default”):
vi default
You should see a line that lists your directory before (/home/web/public_html for example) and afterwards it will say “AllowOverride none“. You want to change this so:
[Move cursor to "none"]
[hit "i"]
[hit Del to remove "none"]
[type "none"]
[hit Escape]
:wq
That should change it (you can edit the file however you want, it’s an easy fix).
Restart Apache
Simply (at the command prompt):
service apache2 restart
No comments yet.
Leave a comment
Please share, it makes me happy:
Subscribe to Email Alerts
Make a Donation
Popular Posts
Follow Me
Recent Posts
Archives
Tags
Blogroll
- 456 Berea St
- ActionScript 3 Design Patterns
- adactio – home of Jeremy Keith
- ajaxian
- Boxes and Arrows
- Chris Brogan
- CSS Globe
- InsideRIA
- Jarrod Michael Studios
- Johan Brook: Designer and Developer
- Mad Vertices
- NETTUTS
- Portsmouth Community Calendar
- Roomware Blog
- Signal vs. Noise
- Six Revisions
- Snook
- Style Grind
- Tiago’s Weblog
- Viget Extend
- Vitamin
- Whats the latest
- Woork
- zupko.info
