You put a lot of effort into your business’s WordPress site. You’ve made sure the theme is perfect, written up some great content, and tested and retested your links. But what if there was one major task you were overlooking, one that could make the difference between great search engine results and being banished to the third page? It’s something called the .htaccess file, and if this little configuration tool hasn’t grabbed your attention lately, read on.
What is the .htaccess file?
This file is a server configuration file and acts as a set of rules for your website and all of the pages and posts it contains. It can be found by accessing your site’s files via an ftp server and find the .htaccess file in the root folder of WordPress.
Why should you create a new .htaccess file for your WordPress site?
The reason the hidden .htaccess file is important in WordPress is something called permalinks. It is the way your pages are named on the world wide web. Think of the .htaccess file as a search engines road map of your site. You wouldn’t want to send Google or Bing down a wrong turn, would you? Some other important reasons for a strong .htaccess file include:
- The .htaccess file routes your URLs, or your website’s pages.
- If posts and pages aren’t named correctly, they will not be indexed correctly by search engines.
- Some WordPress plugins can alter the .htaccess file without your knowledge.
- You may not want all your pages to be indexed by Google. Examples of this include custom templates, author tags, tag pages, archives, or old pages.
Manually set your permalinks.
WordPress makes it easy to set permalinks to display the way you want them to without having to alter your .htaccess file’s code. It is one of the first things you should do when setting up your website. First, log in to your site’s dashboard. Navigate to “Settings”, and choose “Permalinks”. From here, you can choose how your permalinks will display. The choices are:
- Plain, which displays your URL like this: http://www.webpage.com/?p=123
- Day and Name, which displays: http://www.webpage.com/2018/08/11/name-of-post/
- Month and Name, which displays: http://www.webpage.com/2018/08/name-of-post/
- Numeric: http://www.webpage.com/archives/123
- Post Name: http://www.webpage.com/name-of-post/
- You can also choose to create a custom structure.
Backup your .htaccess file.
If you’re ready to jump into editing your .htaccess file, always make sure there is a backup of your old .htaccess file. Do this before any alterations of any kind are made. A few very simple ways to backup your file is to download it onto your computers hard drive, or rename the original file by right clicking on it and naming it .htaccess.bk.
After your file is backed up, make a copy of the file. You can then make any changes you like to the copy.
How to access your .htaccess file in WordPress using Control Panel.
Log in to your WordPress control panel and navigate to the file management section. Click “File Manager”. Select “show hidden files” and select the public_html root. Find the .htaccess file and right click on it. Select “edit”. You can also edit the file using an ftp client or by downloading a WordPress plugin made specifically for that purpose. Several popular SEO plugins have a way to edit the .htaccess file in their features section.
What are some popular changes to make in the WordPress .htaccess file?
Here are a few tips and things you can do to optimize your .htaccess:
- Redirect URLs. If the URL has been altered, it’s important to include a 301 redirect. You can use 301 redirects to direct a page, post, or the whole website.
- Block include-only files. This function allows you to block pages that have no purpose.
- Hide directories. A simple piece of WordPress code can block access to main directories and all its sub-directories.
- Ban IP addresses. There is an option to block questionable IP addresses, and you can turn it on with a bit of code added to the .htaccess file.
- Limit image hot-linking. Altering your .htaccess can ensure that no one can hotlink images on your site except you.
- Fix duplicate content. Duplicate content hiding on your site can negatively effect your search engine rankings.
It’s easy to make these changes and others to improve the performance of your web site and optimize your .htaccess file for the best search engine results possible. For instructions on the code required, contact us.
If all this sounds a bit complicated, don’t worry. Our professionals have been helping businesses large and small get the most out of their web sites for years. To get help crafting the perfect .htaccess file for your business, just get in touch. We can make sure everything about your company’s website is optimized for the best search engine results possible. For more great SEO tips, check here.