Mengaktifkan mod_rewrite pada Ubuntu 9.10

Mod_rewrite dibutuhkan untuk melakukan penulisan ulang URL berdasarkan regular-expression parser secara on the fly. Manipulasi URL bisa dilakukan untuk server variable, environment variables. HTTP headers, time stamps dan lain-lain. mod_rewrite beroperasi pada URL lengkap (termasuk bagian path-info) baik dalam konteks per-server (httpd.conf) dan konteks per-directory (.htaccess).

Pengaktifan mod_rewrite ini sangat terasa jika kita ingin menginstall suatu cms di localhost. Jika mod_rewrite belum diaktifkan, biasanya akan ada masalah dalam instalasi.

Langkah-langkah mengaktifkan mod_rewrite di ubuntu :

1. Aktifkan mod_rewrite dengan perintah di terminal/console:

sudo a2enmod rewrite

dengan perintah diatas, maka kita bisa melihat file rewrite.load di /etc/apache2/mod-enabled dan untuk lebih meyakinkan lagi, anda bisa membuat file php yang isinya : <?php phpinfo(); ?>

2. Edit file /etc/apache2/site-enable/000-default

edit : AllowOverride none menjadi AllowOverride all

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

3. Restart apache dengan perintah di terminal/console:

sudo /etc/init.d/apache2 restart

Selamat mencoba:mrgreen:.

3 thoughts on “Mengaktifkan mod_rewrite pada Ubuntu 9.10

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s