I change a line in this folder etc/apache2/apache2.conf
with: AllowOverride None
to AllowOverride All
and I make sure AccessFileName .htaccess
is set correctly.
Then enable rewrite using this command:
sudo a2enmod rewrite
Then restart apache2:
sudo service apache2 restart
This is my simple .htaccess code:
# 1 ---- Establish a custom 404 File not Found page ----
ErrorDocument 404 /index.php
# 2 ---- Prevent directory file listing in all of your folders ----
IndexIgnore *
#block hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ style/logo/logo_icon.png [NC,R,L]
Then I get this when I access the main index.php file: Forbidden
You don't have permission to access /index.php on this server. Server unable to read htaccess file, denying access to be safe Apache/2.4.12 (Ubuntu) Server at mydomain.com Port 80
The server system I am using is: Ubuntu 15.10 Server 64-Bit I cant seem to figure out where I am going wrong, I am completely new with servers also done a good amount of research however I seem to still be limited on my abilities, I would appreciate any help :)