WordPress Code Snippets

A fresh mix of code snippets and tutorials

Canonical snippets for WordPress


.htaccess enables us to easily clean up 404 errors and other misdirected HTTP traffic for better SEO. Here are some canonical snippets for WordPress and beyond.

Canonical .htaccess snippets

Each of the .htaccess directives below include a brief description as an inline comment (# like this). Not all of these techniques will apply to every site, and most of them are specifically for WordPress. Recommended to read the description, grab what is useful, and include in the root .htaccess file of your site. Note: the last three snippets are useful for any website, not just WP.

Remember to change all instances of example.com and example.com/wp with the URL of your site and WordPress installation directory. For example, if you have WordPress installed in the root directory instead of a subdirectory named “/wp/”, you would change all instances of example.com/wp to simply example.com. And so on and so forth.

Good day to you!

Learn more

.htaccess made easy

Show Support

Like our new Facebook Page to show support!