After hosting my website on Plone and attempting to host it on plain HTML5 I decided that time has come for me to use a CMS. As I wrote in the Hello World post (i.e. the first post) I chose to use WordPress. I installed it and as my work and life made me busier and busier, I kind of ignored. It is very apparent from the irregularity of the posts and blank periods in the posting.
Anyhow, the point is that I didn't realize that the permalinks, categories and tags were not working. When I clicked on a particular post or tags or categories, it showed me a 404 error. So essentially I had a broken site on my hands. And here I was wondering why my site was not coming up in searches and why I was not getting any traffic. SEO helps Google to crawl and index the website most effectively when permalinks, tags and categories are setup correctly.
Apparently, it is a very common error in WordPress with a very straight forward solution. A simple google search most likely leads you to the right solution. My objective is not to add to the burgeoning posts of "How to fix 404 errors on WordPress". The objective of this how-to is to address one edge case that will occur when you are trying to host WordPress on your own server/computer.
I followed a lot of posts and almost all of them told me the same thing.
- Re-save the permalink settings and
- Ensure you have the .htaccess in your WordPress directory (some of them don't tell that you should have it in the WordPress directory though).
I was at my wits end on what to do to solve the problem. I was about to give up and try and reinstall WordPress when I came across this site and the how-to. That how-to does address the edge case of people like me who like to run their own web servers instead of buying managed hosting. In fact, I am running my site in containers. In fact re-installing WordPress would have added work and would have broken my site. Thankfully I stayed away from it.
The rewrite module of Apache is not automatically enabled. This was the "A-HA" moment for me. I checked out the modules that were loaded by running
sudo apachectl -L and sure enough there was no rewrite module enabled there. I double checked that I had the rewrite module binary in the
mods-available directory in my Apache distribution.
At this point, I was ready to enable the module by running
sudo a2enmod rewrite and
sudo service apache2 restart on my server and enable the module. After that, I was able to reset the permalinks to whatever I wanted it to be. This fix also worked tags and categories.
I hope this helps whoever is facing this issue.
30 thoughts on “Troubleshooting and fixing 404 errors on a self hosted WordPress”
An outstanding share! I’ve just forwarded this onto a friend who has been conducting a little research
on this. And he in fact bought me dinner because I found it for him…
lol. So let me reword this…. Thank YOU for the
meal!! But yeah, thanks for spending the time to discuss
this issue here on your site.
Thank you for your kind comment. Glad it helped.
Cool blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple tweeks would really make my blog jump out.
Please let me know where you got your theme. Thanks
Thanks for sharing your info. I really appreciate your
efforts and I will be waiting for your next post thanks
I do consider all the concepts you have presented to your post.
They are very convincing and will certainly work. Still, the
posts are very short for starters. May you please lengthen them a little from subsequent time?
Thank you for the post.
I think the admin of this website is actually working hard for his site, for the reason that here every data is quality based stuff.
I’m really enjoying the theme/design of your website.
Do you ever run into any web browser compatibility issues?
A number of my blog visitors have complained about my site not working correctly
in Explorer but looks great in Chrome. Do you have any suggestions to help fix
After looking over a few of the blog posts on your web site,
I honestly like your way of blogging. I bookmarked it to my bookmark site list and
will be checking back soon. Take a look at my website as
well and tell me how you feel.
I’m impressed, I must say. Rarely do I come across a blog
that’s equally educative and interesting, and let me tell you, you have hit the nail on the head.
The problem is something not enough folks are speaking intelligently about.
I am very happy that I found this in my search for something concerning this.
Having read this I thought it was extremely informative.
I appreciate you taking the time and energy to put this informative article together.
I once again find myself personally spending a significant amount of time both reading
and commenting. But so what, it was still worth it!
you are in reality a good webmaster. The site loading pace is incredible.
It seems that you are doing any unique trick. In addition,
The contents are masterwork. you’ve done a great activity on this matter!
Hi there, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam comments?
If so how do you prevent it, any plugin or anything you
can advise? I get so much lately it’s driving me mad so any support is very much appreciated.
Simply to follow up on the update of this subject on your web site and would
want to let you know simply how much I treasured the time you took to produce this beneficial post.
Within the post, you actually spoke regarding how to really handle this challenge with all comfort.
It would be my own pleasure to build up some
more concepts from your web site and come as much as offer
people what I have learned from you. Thanks for your usual excellent effort.
Do you mind if I quote a few of your articles as long as I provide credit and sources back to your blog?
My website is in the very same niche as yours and my users would certainly benefit from a lot of the information you provide here.
Please let me know if this alright with you. Thanks a lot!
wonderful post, very informative. I’m wondering why the other specialists of this sector don’t realize this.
You should proceed your writing. I am confident, you have a great readers’ base
Pretty nice post. I simply stumbled upon your weblog and wanted to mention that I’ve
truly enjoyed browsing your blog posts. After all I’ll be subscribing for your feed and I’m hoping you write again very soon!
magnificent post, very informative. I ponder why the other experts of this
sector do not notice this. You must continue your writing. I
am sure, you’ve a huge readers’ base already!
Wonderful blog! Do you have any recommendations for aspiring writers?
I’m planning to start my own site soon but I’m
a little lost on everything. Would you suggest starting with a free platform like WordPress or go for a paid option?
There are so many options out there that I’m totally overwhelmed ..
Any recommendations? Thanks!
Spot on with this write-up, I really believe that this web site needs far more attention. I’ll
probably be back again to read through more, thanks for the info!
I’m really impressed with your writing skills and also with the layout on your weblog.
Is this a paid theme or did you modify it yourself? Anyway
keep up the excellent quality writing, it’s rare to see a
nice blog like this one nowadays.
Howdy would you mind letting me know which hosting company you’re using?
I’ve loaded your blog in 3 different web browsers and I must
say this blog loads a lot faster then most. Can you recommend
a good hosting provider at a honest price?
Cheers, I appreciate it!
Good day! This is kind of off topic but I need some help from an established blog.
Is it very difficult to set up your own blog?
I’m not very techincal but I can figure things out pretty fast.
I’m thinking about setting up my own but I’m
not sure where to begin. Do you have any points or suggestions?
Keep this going please, great job!
Have you ever thought about creating an ebook or guest authoring on other sites?
I have a blog based upon on the same subjects you discuss and would really like to have you share some stories/information. I
know my readers would enjoy your work. If you’re even remotely interested, feel free to shoot me an e-mail.
Have you ever considered about including a little bit more than just your articles?
I mean, what you say is important and all. However think about if you
added some great photos or video clips to give your
posts more, “pop”! Your content is excellent but with images and video clips,
this site could definitely be one of the greatest in its
niche. Wonderful blog!
Excellent website you have here but I was curious if you knew
of any forums that cover the same topics talked about in this
article? I’d really like to be a part of community where I can get comments from other
experienced people that share the same interest. If you have any
suggestions, please let me know. Many thanks!
I don’t even know how I ended up here, but I thought this post was great.
I don’t know who you are but certainly you’re going to
a famous blogger if you aren’t already 😉 Cheers!
I’m really impressed together with your writing talents and also with the structure in your
weblog. Is this a paid subject or did you modify it yourself?
Anyway keep up the excellent quality writing, it is uncommon to look a nice
weblog like this one nowadays..
Fantastic post but I was wondering if you could write a litte more
on this topic? I’d be very grateful if you could elaborate
a little bit more. Thank you!
Appreciate the recommendation. Let me try it out.