If you haven’t already, you should really switch to permalinks. /?p= is an unfriendly, unSEO link. Go to your settings –> Permalink and set custom like this /%category%/%postname%/
Okay, so at first glance that seems easy enough right? Well yeah.. Not so much. First of all, I had to enable mod_rewrite in apache. (Remember I’m on a VPS) That wasn’t difficult, you just use the command a2enmod on Ubuntu/Debian systems. Now with that done, I could use the .htaccess file generated by WordPress to serve up the new fancy URLs. Wait.. My old /?p= are not being forwarded to the new fancy urls. Well, a simple plugin called Permalink Redirect solves that issue.
Now comes the real fun. Everytime I go to try and access my stats, I get a 404. The stats folder is clearly there, but I cannot access it. So, I remove the .htaccess on that folder. I can now access it, but it’s no longer password protected I really wasn’t sure if this was caused by ISPConfig or the .htaccess.
So I searched around for quite some time. The solution is simple, when you go to a password protected area it looks for the 401 and 403 error files first, before giving you a login prompt. With the new rewrite in place, all the errors are now on the WordPress theme. It doesn’t have these errors, so the resulting error is 404 not found.
Anyway, how do you fix this issue? Simple, add the following lines to your .htaccess file in the root directory.
ErrorDocument 401 /[path_to_file]/myerror.html
ErrorDocument 403 /[path_to_file]/myerror.html
That’s it! Problem solved. I can now access my stats directory with the password, and permalinks are working.