How I Got Clean URLs For My Blog

By: Anton McClure;

Published: January 9, 2020

Categories: Technology; General;

A simple and free solution for SEO-friendly URLs that can be used with virtually any web app.


Like many people and organizations, my site has portions that are powered by open source software. An example of that would be the code powering this blog, from (with permission from Ben, of corse).

More specifically, our blog's code is derived from:

foreach (array_reverse(glob("pages/*.md")) as $page) {
    $yaml = $parser->parse(file_get_contents($page))->getYAML();
    if (!$yaml["published"]) continue; ?>
    <a href="?page=<?=basename($page, ".md")?>">
    </a> - <?=$yaml["date"]?><br>
<?php }

Our code has had many additional modifications from feature, reliability, and security update. Regardless, this is what the code started as.

This code worked, for the most part, but URLs were written like, rather than an SEO-friendly In order to fix this, some NGINX code is needed.

The rewrite code that worked for me is shown below:

        location /blog/ {rewrite ^/blog/(.*)$ /blog/index.php?page=$1 last;}

Feel free to use and adapt this in your nginx configs as you deem necessary.

Recent Articles

Is DNSSEC Adoption Worth It?

By: Anton McClure;

Published: February 11, 2020

Categories: Technology; Internet; DNS;

DNSSEC has a lot of hype surrounding it, but is it worth adopting?

Microsoft Launches New Edge Browser

By: Anton McClure;

Published: January 16, 2020

Categories: Technology; Microsoft;

The stable release of the new Microsoft Edge is now available for download.

Windows 7 Support Ends in 1 Day - What Options do Windows 7 Users Have?

By: Anton McClure;

Published: January 13, 2020

Categories: Technology; Microsoft; Windows;

Support for Microsoft Windows 7 will be ending in less than 24 hours. What options do those still on it have?

Resignation from Head Administrator of Zenith Shell Provider and Web Host (formerly Summit Tilde)

By: Anton McClure;

Published: January 10, 2020

Categories: Unorganized;

Resignation notice for Zenith Shell Provider and Web Host (formerly Summit Tilde).

New Blog

By: Anton McClure;

Published: January 2, 2020

Categories: General;

Introduction post for new blog.