After enable Apache and PHP (also installing MySQL) on my macbook, i want to enable mod rewrite (Rewrite engine) . From wikipedia, Mod rewrite (rewrite engine) described as software that modifies a web URL‘s appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly – SEF) are used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.
By default, mod rewrite has been enabled. But we need edit some configuration before we can use it.
- Go to /etc/apache2/httpd.conf than edit the <Directory /> section. Change AllowOverride to All
AllowOverride All
- Edit /etc/apache2/users/youruser.conf, change to this:
<Directory "/Users/youruser/Sites/"> Options Indexes MultiViews FollowSymlinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory "/Users/youruser/Sites/*/"> Options Indexes MultiViews FollowSymLinks </Directory>
- Done. 🙂