Tag Archives: web server

This is the correct installer for Scalable WordPress in the Azure portal.

Setting Up Scalable WordPress Installs On Microsoft Azure

Today, Microsoft announced it was creating what it’s calling “a Scalable CMS solution with WordPress.”

In short, it’s a quick installer that

  • spins up an instance of a standard-tier Azure website,
  • adds a MySQL database (and MySQL DB server, if you don’t already have one),
  • creates an Azure Storage container to hold the wp-content folder (and allows you to create an Azure Storage account if you don’t have one)
  • puts a default WordPress install on that site, and
  • adds a special plugin that communicates with the Azure Storage account.

Much of the code I produce for my day job runs on Azure (both IaaS and Websites), and most of my employers’ websites run on WordPress. (None of those sites are hosted on Azure, however.)

Since a lot of my code does something to a WordPress site, and most of the code I write runs on Azure, you can imagine my joy at having a quick and easy way to spin up and manage WordPress test installs on Azure.

So I went ahead and set up an instance. Here’s a walkthrough, as well as my experience.

Continue reading

Patrons at Mathew's Pub in Portland, ME on April 4, 2014. © Ben McCanna via Flickr. All rights reserved, used by permission.

How To: Use Transients To Speed Up WordPress Templates

Background on how caching works in WordPress, and when it makes sense to use transients, is in the introduction to this post, Using WordPress Transients To Speed Up Your PHP-Heavy Templates: Introduction.

WordPress transients are a simple way to store markup in the WordPress database for short periods of time.

In effect, transients are a kind of mini-cache. They allow us to store finished markup, generated by a template, that’s computationally expensive to create — such as a custom WP Query.

“Transients” are called that because they eventually expire. When some period of time is up (or we intentionally replace or expire the transient), WordPress can rebuild that transient and store it again for some period of time.

This has the net effect of speeding up page load times. Rather than the template having to repeatedly crunch the same code, over and over, to produce the same chunk of markup, the webserver does it once — and serves up that saved markup to all subsequent users.

That’s a lot easier on the server, so it makes pages load faster and reduces errors that can be created when a webserver is under stress.

Continue reading

Dusk over the highway

Using WordPress Transients To Speed Up Your PHP-Heavy Templates: Introduction

This post serves as background to the post, “How To: Use Transients To Speed Up WordPress Templates.”

WordPress is a powerful content management system, and over the years its ability to render very complex data in pleasing, human- and machine-readable formats has been greatly improved.

Thanks to changes in the taxonomy model, as well as improvements in the core functions that surround templates / themes, a designer doesn’t run into nearly as many cases these days of having to run lots of PHP code in a template file.

Even so, sometimes you just can’t avoid having to use a template file to run a complex WP Query, or otherwise put together a bunch of PHP to get something onto your WordPress-based site.

As you’ve no doubt discovered, depending on how code-heavy your template proves, and what resources your Web server has, this can lead to very long processing times, meaning very slow page loads.

Worse, on-template PHP code often can’t be cached, especially if it isn’t centered around a single post / page or a particular taxonomy term.

Continue reading

Correcting Permalinks After Moving Content From A Subdirectory To Root

Ran into this problem with the blog:

As previously noted, I moved my WordPress install from a subdirectory to the root of my Web site. I tried the “Giving WordPress Its Own Directory” method, but I didn’t trust it, so I decided to go ahead with a physical move of the software to root.

As a result, all permalinks to the 200+ articles in this blog became broken, since the subdirectory /blog/ was part of the permanent path root. This was bad, because Google has all those old links wrong, and so does my YOURLS install.

So, I needed a fix, stat. Thankfully, Apache has the mod_alias module, which does a better job of rewriting URLs from subdirectories to root directory than mod_rewrite does.

I specifically used the RewritePermanent directive, which allows one to specify part of a URL string, and to where URLs containing that string should be directed. In my case, I wanted to direct all URLs that contained the  /blog/ subdirectory to the root of my site. Thus:

<IfModule mod_alias.c>
RedirectPermanent /blog/ http://www.dougv.com/

The first argument after RedirectPermanent is the part of the URL you want removed. The second argument is the URL to which you want found URLs redirected.

This works far better for me than the handful of mod_rewrite rules I tried to accomplish the same basic task.

Your Web server must have mod_alias installed for this to work. Most shared Web hosts will have installed mod_alias, but some might not, or might only enable it for selected domains, as a lot of rewrites and aliases can cause trouble with search engine rankings. Check with your Web service provider.

A hat tip to julianmatz at experts-exchange.com for the tip. All links in this post on delicious: http://www.delicious.com/dougvdotcom/correcting-permalinks-after-moving-content-from-a-subdirectory-to-root