You may have noted that my blog site has a new look. Well, that was totally unplanned and actually the consequence of a major problem that occurred today. Luckily enough solving it turned into a learning moment. I am going to share my findings here so that others can benefit from them. While my problem was specific, the steps I used to isolate it apply to a broader range of issues.
Some background information first: my blog is based on the Gantry Framework, which consists of a plugin and a theme. The plugin and the theme work together in order to provide a framework through which you can easily set the look and feel of the blog pages, layouts, widgets, etc. Very practical if you don’t want to spend time programming an own template or tweaking one of the many available boilerplates.
Being a plugin, Gantry is automatically updated through the WordPress update mechanism any time it is necessary. The same should apply to the theme… or so I thought!
I have been using Gantry for quite some time now, starting close to version 1.0 and upgrading along the way. The latest release as of this writing is 4.08. Now here is the whole point: while the plugin is indeed automatically updated, the update to the theme stopped to work for any reasons. As a consequence, I ended up using without knowing an outdated theme.
Everything worked well though until today, when suddenly and unexpectedly, trying to login in to my blog as Administrator produced a weird “ERROR 301 TOO MANY REDIRECTS”. I really couldn’t figure out what was wrong since everything was working fine until the day before and I hadn’t installed any plugin or update since then.
After the initial disbelief (and some cursing to my ISP), I went into troubleshooting mode. Not having access to the WordPress dashboard made it just more… interesting!
Here what I did:
1) Disable all plugin. This can be done through FTP by simply renaming the directory plugins inside wp-content to something like plugins-STOP. You can gain FTP access to your site usually through cPanel or similar. I have my site FTP configured in FileZilla.
2) Make sure all file permissions are right. You never know what your ISP could be doing with them! The standard in WordPress is to have all directories at 755 and all files at 644. Be careful with those changes because getting it wrong could make your WordPress installation vulnerable. File permissions can be checked and changed either through cPanel or directly from your FTP client.
3) Revert to a standard theme. Without being able to access the dashboard, this step can be accomplished accessing the database. Inside the wp_options table, look for option_name “stylesheet” and “template”. Change their option_value to “twentythirteen” in case of the latest WordPress version (3.6). Then look for option_name “current_theme” and change its option_value to “Twenty Thirteen”. Commit all changes. Note that your WordPress installation may use a different table prefix, so your option table could have a different name like 123_options. Accessing the WordPress database is usually possible through phpMyAdmin from cPanel.
Once I went through the 3 steps above I was able to display my blog properly (even though with the Twenty Thirteen theme) and login into it as Administrator worked as expected. Everything as functioning perfectly at this point, so I had 2 suspects: either a faulty plugin or a faulty theme.
I went then on to restore the name of the plugins directory and to reactivate the plugins one by one, checking after each reactivation that everything was working as expected. And it was, so it wasn’t a plugin problem.
Next I checked the themes. From the Appearance menu –> Themes I reactivated the Gantry Framework theme and… the error was back! I couldn’t login into my blog as Administrator and I got back the “ERROR 301 TOO MANY REDIRECTS”. 🙁
The solution was simple. After having switched back to Twenty Thirteen (yes, another round in phpMyAdmin) to get a working blog, I checked on the Gantry Framework site to find out that I was using Theme version 1.23 when the most current one is 4.08!
The theme had to be downloaded and updated manually. Once activated and after having checked that everything was working as expected with the new theme, I also had to re-configure the whole framework to get to the wanted look & feel. I let you judge whether it is better than the previous version.
Lesson learned: if suddenly you cannot login as administrator to your WordPress site and get a weird error like “301 TOO MANY REDIRECTS”, before messing up with your .htaccess file or cursing your ISP, try the simple steps above and see if you can isolate the problem. Usually it will be either a faulty plugin or a faulty theme and both situations can be easily solved!
Till next time!