Category Archives: htaccess

How to enable use of .htaccess

First Step
Open file as
sudo vim /etc/apache2/apache2.conf

Second Step
remove comment sign (#) if you find it before this line ( line number 187 approx.)
AccessFileName .htaccess

Third Step
Then find the line where there is

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride 
None
Require all granted
</Directory>

replace “None” with “All”
AllowOverride All

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

 

Rujukan : –¬†http://webmasters.stackexchange.com/questions/61009/how-to-enable-use-of-htaccess-in-apache-on-ubuntu

Edit pada fail .htaccess

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://hezrul.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]