How to configure Apache correctly for WordPress to enable permalinks.

In order to enable permalinks in WordPress, custom htaccess files are created. Your server only reads these if “AllowOverride” is set to “All” in your Apache configuration.


# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

If you host a single site within an “html” directory:

<Directory "/var/www/html">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>

If you host multiple sites within the “www” directory:

<Directory "/var/www">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>

Do not put “AllowOverride All” in for security reasons. Notice how it states “First, we configure the “default” to be a very restrictive set of features.”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.