Apache to Nginx transition on WordPress – don’t forget the permalinks

After having transitioned from Apache to Nginx as the web service for this blog, I noticed an immediate drop-off from search engine traffic to links outside of the index page. Just attributing it to blind bad luck for a few days, I later realized that permalinks were broken because I didn’t correctly translate the rewrite rules from the Apache configuration to Nginx.

Apache config for WordPress permalinks:

  Options FollowSymLinks
  Options SymLinksIfOwnerMatch
  RewriteEngine On
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

Correct equivalent Nginx config:

  location / {
    index index.php;
    try_files $uri $uri/ /index.php?$args;
  }

For a minute I thought search engines were blacklisting me for unpopular opinions on this blog.  Don’t attribute to malice what can be attributed to (my own) stupidity.

*     *     *

If you’re looking for a cheap alternative to home security that costs literally one-twentieth of what most security companies charge, try out Simple Home Monitor for free.

Leave a Reply

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