Fix for Broken Permalinks after WordPress Server Move

The Permalink Problem

I recently moved a few WordPress 2.8.x sites from one server to another. Oddly, when clicking on individual blog entries, every one of them threw a 404 after restoring onto the new server. Index page was fine. Admin pages were fine. But any specific blog page was 404’ing. Hmm.

The Permalink Fix

Admin -> Settings -> Permalinks and clicked Default, then back to Month and name. That’s it.


My Suspicions

I really have no idea, and I don’t have time to investigate. Was it specifically the act of restoring the database (server environment agnostic)? Or was it the other way ’round? Or some other cause?

Tags: , , , ,

Improve a Stock WordPress Install

A client asked me — now that his new site is working well and he’s comfortable running it — what improvements (tweaks, plugins, whatever) would I suggest to make it better? Here’s what I said:

  1. His site is not served from the “root“, so I recommended he serve it from the root. Example: don’t do instead do! If it’s not possible to serve from the root, it’s not a showstopper. SEO will actually not suffer if you don’t act. Your content is generally judged on how relevant it is + how many link to it + how often it’s freshened. The depth of the URL — at only 1 directory — shouldn’t matter. Do it for human readability reasons.
  2. A nice touch/eyecandy is a Javascript called Lightbox (link to WordPress plugin). You can see it here by clicking on the images. It can also act as a dumb gallery for sets of images. Works automatically — nothing for you to do.
  3. Your traffic may already be tracked by a server-side app like AWstats. Whether it is or not I suggest the free Google Analytics. Warning: Google will know your site’s traffic from the inside. I feel that using Analytics isn’t giving up my sites to the Dark Side, and that getting the (very, very powerful) traffic analysis is worth the trade. I use GA on all my sites.
  4. Many Twitter plugins like this one are available to display (presumably your) Tweets if you’re interested.
  5. Sitemap plugin improves SEO by writing to an industry-standard xml file at site root that search engines bots read and digest. I use sitemaps on all my sites. Highly recommended and nothing for you to do.
  6. Social bookmark plugins like this one add a “Share This” link on each blog post. I’m not crazy about these but there is no downside that I can think of. Helps SEO if the links are used.

WordPress 2.8 Released Today

WordPress 2.8 “Baker” was released this morning. I tested it on a few mule sites first, including this one, and all updates went perfectly. I’ll have more regarding a 2.8 w/plugins Plugin Auto-Update Stress Test in the next day.

Best practices for upgrading WordPress

Download latest WordPress build, immediately delete wp-content folder(!). Then go about upgrading normally, which is to say backup web files and db, then simply overwrite all files and directories in your WordPress directory. Then go to the Dashboard and click the large, obvious Upgrade Database button. Upgrades take 5 minutes typically, start-to-finish.

Jealously guard /wp-content. It’s where your theme, plugins and image/media uploads live — the unique bits — and will not be touched if you nuke that directory when you unpack the latest builds.

Solution for query_posts() Breaking Things & Causing Havoc

According to my experience and WordPress support forum entries like , the very powerful and useful WordPress function query_posts() breaks several other features like search, next post/previous post, and maybe more. Ugh.

A client wanted their blog post page to show entries only from the current calendar week starting on Monday. So if it was Thursday, the index page would show posts from the last four days, Monday-Thursday. If there ever was a mission for query_posts(), this was it.

$weekstart = date("W");

(Put that above The Loop. It uses PHP’s date() function to get the current calendar week’s first day, which by definition and luck happens to be Monday.)

Fine, but hold on: search broke. A search would return nothing. Who was the culprit? Why it’s query_posts(). I was shocked, shocked (sarcasm).

Here’s how I got around it: I figured if I could make search use another template, one without the offending function, I’d be fine. I looked into that but didn’t find much (didn’t spend too much time looking though). Then I had a better idea: don’t move search, move the index page.

  1. create a new template with your troublemaking query_posts() on it, name it Home
  2. create a new page, give it the Home template
  3. in Admin -> Settings -> Reading set Front Page Displays Static Page -> Home
  4. return the template file index.php to its original state, or at least take off query_posts()

That’s it. Search works because it’s not using the offending template. Home works becuase I get to keep query_posts() on it to display the week’s posts like the client wants. Everybody’s happy.

Tags: , ,

Linking in WordPress

The link and unlink icons in WordPress

I got an email today from a client asking how to make words in his blog go to other sites. Good question! He was talking about creating “links”, also called hyperlinks <- there’s one.

The button on the left is the link button, the other is the unlink button. Those appear in the WordPress editor’s toolbar when you are composing a blog post.

How to Link In WordPress

1. write something
2. highlight the word or words with your mouse
3. click the link button
4. enter a URL (must start with “http://”)

You’re done. To unlink, highlight the word(s) and click the unlink button.

When you publish that blog post, the word(s) will take the user to whatever URL you put in. The word(s) will usually be underlined, which is the universal convention to identify a hyperlink.

If you’re talking about writing on an older version of WordPress, or a non-WordPress blog, it should work the same way, or very similar. This is a standard used for over a decade in all kinds of computer programs.

Tags: ,

How Can I Get More Website Traffic?

Traffic levels are all about content. People ask me about SEO… should they do some SEO basics to their site? Well yea! Do the basics of SEO and promote your site.

I’ve never asked a webmaster if he’s doing everything he can to promote his site and gotten a “yes”.

Real world, online, whatever. If you don’t have your URL in your signature, get it in there! If you don’t hold your website in high regard, nobody else will.

But most importantly, write good content as frequently as possible and users will come. If you can do only one thing do this.

That’s why it’s important to have a site where you can write without noodling with HTML. This is where WordPress comes in, and it’s why I’ve recommended WordPress for probably 19 out of the last 20 websites I’ve consulted on.

Tags: , , ,

Image Upload Problems with WordPress?

Here’s the fix if your WordPress version 2.6 or 2.7 is failing on image uploads with

The uploaded file could not be moved to /var/www/vhosts/

Before you read further, please note A) these instructions are for *nix servers (typically Linux), not Windows servers, so ask your host which you have if you don’t know, B) you’ll need to ssh into your server and run command line commands, and C) I have the very macho root access to my Linux/Apache server, so I can run chown commands. Most hosts will disallow you root access, and you’ll simply have to ask your tech support to do this. That shouldn’t be a problem.

Having said that, you want the ownership and permissions to look like this for these three important directories:

wp-content drwxr-xr-x (755)  user group
uploads drwxr-xr-x (755)  apache apache
themes drwxr-xr-x (755) user group

and PHP safe_mode is OFF

Read the rest of this entry » »»»»» »

Tags: , , , , ,

Display Much Information in a Small Space

So I’ve got this popular Volvo web site with about 11,000 registered users. Super. The heart of it is the Volvo Forum, a roiling, boiling mass of Volvo owners trading information, advice and tears at the rate of 75-100 posts per day. The problem is that from the Home page, it doesn’t look so roiling-boiling. Fix: show the activity on the Home page. Get it out in front of people.

Ok, not a hard task. The phpBB forum (outstanding, free software by the way) is on interior pages, and is run entirely by the site’s database. All I needed to do was query a table in the database for the ten or 15 or whatever number of latest posts and voila, the roiling-boiling is then shown to the browsing hoi polloi.

But a) I wanted it up near the top to lure users deeper into my site and b) I didn’t want it to take up much space.

Ingredient #1

After scouting around for some possibilities I found Latest Posts, a script that pulls latest posts from a phpBB forum and displays them in a scrolling marquis.

Not bad. So I used it at the bottom of the Home page. Read the rest of this entry » »»»»» »

Tags: , , , , , ,

WordPress 2.7 is Out

This post isn’t the place to go on about why I love WordPress and have created only one web site without it in the past 3 years.

This is the place to let you know that WordPress 2.7 is out, and it’s even easier to use than any version, ever. I’ve upgraded one of my sites to it, and I’m very happy.

See how it works:


WordPress Blogging: Best Practices w/ Formatting

My clients sometimes end up with oddly-formatted blog posts on their WordPress sites. It’s usually because they write in Word, copy, then paste into the WordPress text window. That carries ugly, hidden formatting. To get around this, the WordPress authors created the Paste from Word button.

  • Compose in Word or whatever you enjoy writing in… stay comfortable.
  • Don’t format in Word.
  • Open WordPress, Write a Post, Click “Kitchen Sink” button on the toolbar.
  • Click on “W” icon (Paste from Word) when the second row opens.
  • Format to your liking in WordPress with the toolbar buttons.
WordPress' "Kitchen Sink" button

Clicking the Kitchen Sink button opens the second row.

Voila. Consistent formatting across all your posts.

I’m not a fan of the Kitchen Sink functionality. I want the WordPress authors to just display both rows of the formatting toolbar. The extra space taken up by the second row is too little to warrant hiding the second row of buttons to newbies.

Tags: ,