Fixed: Broken Permalinks in WordPress

I recently moved servers to a new host (a friend of mine had provided me with a free CPanel account on his VPS before this), and the transition had appeared to work rather well. Then, when I checked my blog stats this morning, something seemed off:

Blog Stats

See that last big dip? Guess when that happened!

So I started looking around the site, and sure enough – the main pages displayed fine, however everything else was broken. In fact, anything with a ‘fancy’ permalink was 404′ing.

Once again, a quick Google search lead me to this thread on the WordPress forums. After digging around, I found the problem – in Apache’s httpd.conf file on my new VPS, I needed to change the following line:

AllowOverride None needed to be AllowOverride All

Note, though, that there are two AllowOverride entries in httpd.conf – one wrapped in <Directory></Directory> tags, and one all by itself. The problematic one is the second AllowOverride entry that isn’t wrapped in Directory tags.

TL;DR Version: If you enable fancy permalinks in WordPress, and start getting 404 errors in Apache even with a proper .htaccess file and mod_rewrite enabled, change AllowOverride None to AllowOverride All in httpd.conf – just make sure you do it to the second AllowOverride entry!

Updated! If you’re using nginx instead of Apache, simply add the following to the location section of your nginx.conf file (or the one for your vhost, if you’re doing that):

if (
    !-e $request_filename) { rewrite ^.*$ /index.php last;
}

Updated again! If you’re using ligHTTPD, you can add the following line to lighttpd.conf (although if you are using your own custom 404 error page, you may wish to find another solution):

server.error-handler-404   = "/index.php"

Comments (4)

  1. 1:45 pm, July 11, 2010Tracy  / Reply

    I tried to do this on my blog, but I very quickly got lost and frustrated. So I’m back to the good ol’ ?=p26 format.

    • 2:07 pm, July 11, 2010Laslow  / Reply

      You need full root access to your server/VPS to do this, or a host that lets you edit the httpd.conf file. If they don’t let you, you can open a support with most and have them do it.

  2. 6:22 am, April 18, 2011miele  / Reply

    Thanks! This really solved my problem.
    Searched for it for several hours.

  3. 3:20 pm, January 11, 2012lazaac  / Reply

    i’ve got it work! thanks mat!

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Pingbacks (0)

› No pingbacks yet.