: 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
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?
More posts by @Ogunnowo487
4 Comments
Sorted by latest first Latest Oldest Best
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.
Activate ModRewrite:
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
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!!
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.