How to: (Almost) Pretty Permalinks in WordPress on Raspberry Pi

When you’re using WordPress as a Content Management System (CMS), you are faced with a choice. Which permalink settings should you opt for? However the choice you make, can be obstructed by an annoying fact; that your permalink is almost pretty.
The default setting for WordPress would most likely be http://your-pi-IP-address/?p=123 This is what we would define an “ugly” permalink.
WordPress gives us different options:

  • Default
  • Day and name
  • Month and name
  • Numeric
  • Post name
  • Custom structure

The problem however is, when you choose one of the other settings, i.e. Numeric, you will most likely get http://your-pi-IP-address/index.php/archives/123

Step 1: Enable rewrite and expires on Raspberry Pi

sudo a2enmod rewrite
sudo a2enmod expires
sudo service apache2 restart

Step 2: Open Apache2.conf

sudo nano /etc/apache2/apache2.conf

Step 3: Edit apache2.conf

Find the start of . It should look something like this:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

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

Change it to the following and save and exit.

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Order deny,allow
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

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

Step 4: Restart Apache2

sudo service apache2 restart

You should now have pretty permalinks on your Rasperry Pi running WordPress.

Leave a Comment

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