Mobile app version of vmapp.org
Login or Join
Ogunnowo487

: How to enable use of .htaccess in Apache on Ubuntu? I'm trying to enable use of htaccess file in Ubuntu 14.04 (Apache 2.4.7). I know that this question has many possible duplicates, but none

@Ogunnowo487

Posted in: #Apache2 #Htaccess #Ubuntu

I'm trying to enable use of htaccess file in Ubuntu 14.04 (Apache 2.4.7).
I know that this question has many possible duplicates, but none of them helped me yet.

.htaccess

ErrorDocument 404 /404.html


000-default.conf

<VirtualHost *:80>
AccessFileName .htaccess

ServerAdmin webmaster@localhost
DocumentRoot /var/www

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

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


What else is needed?

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Ogunnowo487

4 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

In my case the changing AllowOverride None to AllowOverride All in
/etc/apache2/sites-enabled/000-default.conf helped.

All other .conf files have already had AllowOverride All.

10% popularity Vote Up Vote Down


 

@Cooney921

Activate ModRewrite:

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

10% popularity Vote Up Vote Down


 

@Berumen354

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


And voila... .htaccess works!!

10% popularity Vote Up Vote Down


 

@Kaufman445

In /etc/apache2/apache2.conf remove comment sign (#) from AccessFileName .htaccess
The name of your Apache configuration file is not standard. You can rename it to default.conf in Windows and rename it to default in Linux. In Linux based OS run this code in terminal:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme