Memperbolehkan apache2 mengakses file .htaccess , dan mengaktifkan mod_rewrite pada apache2

 
Cara memperbolehkan apache2 mengakses file .htaccess , dan mengaktifkan mod_rewrite pada apache2 ,Masalah ini ditemui pada open sid :
 
kita tidak bisa mengakses, http://localhost/desabeku/first 
tapi kita bisa mengakses, http://localhost/desabeku/index.php/first

asumsi>
Modul mod_rewrite pada apache2 belum dienable atau apache2 tidak diperbolehken mengakses .htaccess

Solusi>
    TERDAPAT 2 SOLUSI YAITU 1 ATAU 0 , FIX OR DELETE?

    #DELETE:
        -Hapus file .htaccess di folder root website


    #FIX:
        # apt-get install apache2
        # a2enmod rewrite
        # service apache2 restart
        # nano /etc/apache2/sites-available/000-default.conf

cari baris kode <VirtualHost *:80>
    tambahkan script berikut dibawah persis baris kode <VirtualHost *:80>
        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
//pastikan AllowOverride None menjadi AllowOverride All , untuk mengaktifkan file .htaccess


Maka akan jadi seperti ini:
<VirtualHost *:80>
    <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
    </Directory>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html


    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


DAN yang terakhir kita restart apache2
      # service apache2 restart

Coba akses open sid dengan url
      http://localhost/desabeku/first

Jika konfigurassi diatas benar maka anda akan melihat tampilan awal opensid


 

Share:

0 komentar