Enabling mod_rewrite
Apache’s mod_rewrite is used for changing the way a website URL maps to the underlying file system. It can be used to make URLs more human-readable, and to disguise the underlying workings of a website. For example, you might use mod_rewrite to change http://www.example.com/index.php?post_id=5 to http://www.example.com/5.
URL rewriting isn’t enabled by default if you install Apache on Debian or Ubuntu – this is how to do it.
You’ll need to navigate to /etc/apache2 and obtain root access.
First, create a symbolic link in the mods-enabled directory to the rewrite.load file in the mods-availabe directory:
ln -s mods-available/rewrite.load mods-enabled/
Next, if you are wanting to use .htaccess files to carry out URL rewriting (likely), then you’ll need to let Apache know that it can use the rules in those files. So, edit the appropriate config file:
nano sites-enabled/000-default
Look for the AllowOverride directive , and change it from “None” to “All”.
Finally, you’ll need to restart Apache to make the changes take effect:
/etc/init.d/apache2 restart