Apache server ignores .htaccess

泪湿孤枕 提交于 2019-12-02 20:11:13
<Directory "/home/page_url/www/">
    AllowOverride None

This AllowOverride None disables .htaccess files from being read. See the manual.

Also, please bear in mind that there's nothing magical about .htaccess files. They are a crude workaround for not having full access to the server configuration. All they are is a piece of Apache configuration. If you have full access to the server configuration, you should be putting stuff like this into the vhost configuration, not .htaccess files.

As Jim said, if you have full access to your server, you should just put everything in the server configuration files.

I reached here because I thought my server was ignoring my own htaccess/server configuration files. However, it turned out I had mod_expires and mod_rewrite disabled. After I had those two looked into, everything was working again as it should.

You can enable them by executing these commands:

sudo a2enmod expires
sudo a2enmod rewrite

Then restart apache

service apache2 restart

Hope this helps someone out there!

One thing to remember if your rewrite rules still don't work:

Also activate the ModRewrite module! It is not by default in Ubuntu.

See other answer here on how to do that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!