in our quest to make our blog as accessible as possible, we have finally found time to implement pretty permanent links (=permalinks) on our self hosted (mac mini running macOS 10.5.8, client version) wordpress installation.
as this turned out to be trickier than expected, we thought we share our experiences & the most helpful resources we found along the way.
to understand the basic requirements for permalinks to work, as first stop we recommend the official wordpress codex entry here. please note this entry is very generic and does only outline the non OS specific requirements.
so let’s assume you have a properly working installation of wordpress installed on 10.5.8 and feel somewhat confident with using terminal & a script editor, then the sequence of things to do is as follows:
1. create a .htaccess file (‘sudo nano .htaccess’) in your sites root folder (i.e. where the wordpress index.php lives), e.g. ‘/Users/YOURUSERNAME/Sites‘ or if wordpress lives in a folder (recommended) then it should read ‘/Users/YOURUSERNAME/Sites/MYBLOG‘ (obviously replace YOURUSERNAME & MYBLOG with your specific choosen names);
2. populate the .htaccess file with whatever the wordpress admin panel > settings > permalinks tells you to add once you have choosen your permalink structure – in our case this was:
[code lang=”text”]Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^u/([0-9]+)$ u.php?$1|$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
[/code]
3. change appropriate permissions (more on this very important/dangrous topic here) , e.g. ‘chmod 666 .htaccess‘
4. configure ‘/etc/apache2/httpd.conf‘ to enable mod_rewrite, uncomment line 112: ‘LoadModule rewrite_module libexec/apache2/mod_rewrite.so‘
5. configure ‘/etc/apache2/httpd.conf‘ to enable apache to read your .htaccess file, uncomment starting from line 173 until you get something like:
[code lang=”text”]Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
[/code]
6. configure ‘/etc/apache2/httpd.conf‘ to allow overrides, change line 210 to ‘AllowOverride All‘;
7. go to ‘/etc/apache2/users’ and create a file called YOURUSERNAME.conf (see above), e.g. ‘sudo nano YOURUSERNAME.conf‘ and add the following:
[code lang=”text”] <directory “/Users/YOURUSERNAME/Sites/MYBLOG”>Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all [/code]
8. restart apache, either from system preferences > sharing > web sharing or from terminal ‘sudo apachectl graceful‘;
9. in wordpress admin > settings > permalinks, choose your permalink structure and check if it is all working;
please note, the above works for us – however, you may have to adjust bits and pieces (particularly the location of files) to suit your specific setup and choosen permalink structure.
other similar tutorials that we found helpful can be found here and here.