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

  • help me ...waiting for answers – jazz_razor Oct 5 '14 at 7:53
7

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>
  • not worked. help me – jazz_razor Oct 5 '14 at 2:30
  • It worked for me, dang updated ubuntu distros >.> – Adam F Aug 19 '15 at 21:31
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.

  • cant find above line in default.conf – jazz_razor Oct 5 '14 at 2:30
  • @jazz_razor You are supposed to add these lines, above the line with </VirtualHost>. – muru Oct 5 '14 at 7:54
  • i added these lines but it still giving me 403 forbidden error – jazz_razor Oct 5 '14 at 7:58
  • i am working in this directory /var/www/html/my_project – jazz_razor Oct 5 '14 at 7:59
  • @jazz_razor I doubt your 403 error has anything to do with htaccess configuration. Have you set permissions correctly? – muru Oct 5 '14 at 8:01
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.

  • 1
    For security reason, other users may only read your .htaccess, you should use sudo chmod 644 /var/www/html/.htaccess to update permissions. – Ramesh Chand Feb 1 '16 at 8:15
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.