问题原文
原帖链接 · David Abgaryan · CC BY-SA 3.0
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?
已采纳解答
原帖链接 · Anil Prz · CC BY-SA 3.0
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!!
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
