Tag Archives: changes

Permalinks in WordPress when upgrade to Apache 2.4

Basic Settings in Apache 2.4

In Apache 2.4 the config Denies Override Attempts on some direcotries by default. This may lead to a not working Rewrite-Enviroment on your Webserver and your WordPress-Permalinks will show “Forbidden” or “Not Found” or “Requested URL not found” pages.

<Directory /usr/share>
 AllowOverride None
 Require all granted
</Directory>
<Directory /var/www/>
 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted
</Directory>

 

The quick and dirty way

If you comment these out, your permalinks should work again. You comment them out using ‘#’.

#<Directory /usr/share>
# AllowOverride None
# Require all granted
#</Directory>
#<Directory /var/www/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>

 

Or updating your vhost configuration

It may be safer to  make some changes in your (v)host configuration file and leave the apache configuration untouched.

        DocumentRoot /usr/share/wordpress/
        DirectoryIndex index.php index.html
        ErrorLog /var/log/apache2/wp-error.log
        TransferLog /var/log/apache2/wp-access.log

        # wp-content in /var/lib/wordpress/wp-content
        Alias /wp-content /var/lib/wordpress/wp-content


        <Directory /usr/share/wordpress>
            Options FollowSymLinks
            <IfVersion < 2.3>
                Order allow,deny
                Allow from all
            </IfVersion>
            <IfVersion >= 2.3>
                Require all granted
            </IfVersion>
            AllowOverride All
        </Directory>
        <Directory /var/lib/wordpress/wp-content>
            Options FollowSymLinks
            <IfVersion < 2.3>
                Order allow,deny
                Allow from all
            </IfVersion>
            <IfVersion >= 2.3>
                Require all granted
            </IfVersion>
            AllowOverride All
        </Directory>

  # wp-content in /srv/www/wp-content/$0
  RewriteEngine On
  RewriteRule ^/wp-content/(.*)$ /usr/share/wordpress/wp-content/$1