Doesn’t .htaccess work?

Some new installed Apache servers ignore  .htaccess files from any folder. You write into .htaccess some rewrites, but it doesn’t give effect.

Or may be you have installed wordpress, you have changed permalinks from standart to custom one, htaccess is created, but all page and post urls give 404 error. So possibly the solution is like the following:

Edit apache’s conf file:

sudo gedit  /etc/apache2/sites-available/default (1. Apache conf address may be different in your server. It depends on server OS, apache configuration.  2. If you are in remote connection and are using SSH, so use vi or nano, not gedit)

In editor you will see such block:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny		allow from all

Change AllowOverride None line to AllowOverride All.  And then save and close editor. Then type in terminal the following:


sudo a2enmod rewrite

sudo /etc/init.d/apache2 restart
That’s all. The problem must be solved.

First posted: