I have just configured my LAMP stack on my Ubuntu 14.04 distribution and want to set .htaccess up to serve a website I am building for a client (he is reluctant for me to use NGINX as his current site sits on top of APACHE)
I followed the tutorial https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file and configured a virtual host for my domain, however I am still unable to use the .htaccess file in my projects root, whenever I try to serve a page I get a 404 error.
The .conf file for my domain looks like:
<VirtualHost *:80>
ServerAdmin alexmk92@live.co.uk
ServerName alexsims.me
ServerAlias www.alexsims.me
DocumentRoot /var/www/alexsims.me
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I tried to change AllowOverride None to AllowOverride All but that caused an internal 500 erorr, can anyone help me out here?
Regards, Alex.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
I had the same issue and solved it now.
After enable mod_rewrite We need to change setting of AllowOverride to All
Option 1: Find available sites you created: ls -l /etc/apache2/sites-enabled
Example display:
ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 35 Aug 5 15:08 000-default.conf -> …/sites-available/000-default.conf
So your site is in file config: 000-default.conf
Open the file if is there any written there? If you could see the folder setting of AllowOverride, change its setting from “None” to “All” on your main web folder (Ex: /var/www/)
If you could see that the file display empty so you should go to Option 2.
Option 2: Change the apache2 configuration to enable override all Find your apache2.conf, in my case, it’s in /etc/apache2/
So open it and change the expected feature:
sudo vi /etc/apache2/apache2.conf
Change on <Directory /var/www/> AllowOverride none
to
AllowOverride All
======== My case, it’s working with Option 2.
Hi, enable mod_rewrite
see http://www.dev-metal.com/enable-mod_rewrite-ubuntu-12-04-lts/
removing the Options Indexes FollowSymLinks MultiViews worked for me
As a non techical person I solved this issue with Option 2 which works for me, Thanks a lot
Here option 2! You saved me :) Tnks a Lot!
Check Apache’s error log:
sudo tail -30 /var/log/apache2/error.log
What does that command output?