4

I already install apache2 then i enable the mod_rewrite module like this:

sudo a2enmod rewrite

after enabling i am confused about these lines, i can't understand what to do with them, as far as i know that what i have to do with these lines is that " find the following section, and change the line that says AllowOverride from None to All. "

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
</Directory>

my problem is that I can't find a file with the above lines to edit. I already looked in /etc/apache2/sites-available/. In that directory, I only found two files:

000-default.conf 
default-ssl.conf 

In both files i can't find above lines which i have to edit.

i edit the file /etc/apache2/apache2.conf in this directory but it still didn't worked at all.

i also looked in this /etc/apache/sites-enabled/default.conf directory but i can't find these lines in dafault.conf

<Directory /var/www/html>
    AllowOverride All
</Directory>

i am working in /var/www/html directory then why it's giving me 403 forbidden error.

Still .htaccess is not running. It's giving me 403 forbidden error.

here is the screen shot of folder permission:

enter image description here

here is the screen shot of 403 forbidden error: enter image description here

5 Answers5

6

Edit /etc/apache2/apache2.conf instead of /etc/apache2/sites-available/ and edit as instructed.

Here's mine:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
Parto
  • 15,647
3

Firstly, in Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html. Secondly, the configuration was considerably simplified, so those entries, while usually present by default, no longer appear in the new default site configuration.

Edit /etc/apache/sites-enabled/default.conf, and add these lines:

<Directory /var/www/html>
    AllowOverride All
</Directory>

Your 403 Forbidden error is possibly because you are working in /var/www where you should be working in /var/www/html.

Finally, you shouldn't be enabling All, but pick out the options you need and enable only those.

muru
  • 207,228
1

Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.

sudo nano /etc/apache2/sites-enabled/000-default.conf

add these lines at end

<Directory /var/www/html> AllowOverride All </Directory>

and of course >

sudo service apache2 restart

0

I had the same issue. Changing the privileges of my .htaccess file to 755 seemed to work.

Lee
  • 11
  • 1
  • 4
0

Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.

sudo nano /etc/apache2/sites-enabled/000-default.conf

add these lines at end

<Directory /var/www/html>
    AllowOverride All
 </Directory>

and of course restart apache2 service

sudo service apache2 restart
pl_rock
  • 11,715