5. Editing Your .htaccess File
In this doc, we will cover:
- Editing your .htaccess file.
- The code required by a WordPress installation.
- The code required by a WordPress Multisite Network.
5.1 Editing Your .htaccess FileLink to chapter 1
When editing your .htaccess file, you will have to access your site via FTP or File Transfer Protocol. There are a number of FTP clients to help you with this based on whether you are using Windows or Mac.
Windows FTP Clients
Mac FTP Clients
You will need some information from your web host to access FTP. Most of this information can be found at your hosts control panel.
- FTP Host
- FTP Port
- FTP Username
- FTP Password
Some FTP clients hide hidden files such as the .htaccess file by default. Because of this you will need to enable display of hidden files.
If FTP sounds to scary to you, it really isn’t. It just takes some getting use to. However, most hosts have cPanel which contains a File Manager. If you are not sure if your host has a control panel such as cPanel, you should contact them directly.
Editing .htaccess In cPanel
5.2 Backing Up Your .htaccess FileLink to chapter 2
Before you go any further, it is highly recommended that you back your .htaccess file up so if needed, you can revert it to an earlier version. One of the things you can do is simply download the file to your computer using your FTP Client or cPanel File Manager. Another way is to backup your website using our Snapshot Pro plugin if you already have an existing WordPress installation.
5.3 Code Required For Your WordPress InstallationLink to chapter 3
Once you have backed up your site, you will want to login using your FTP client. From here, you will want to navigate to “/public_html/.htaccess”. At this point, your .htaccess file should be open. Add one of the code snippets below to the top of your file based on what kind of WordPress setup you have at the top of your .htaccess file.
Single WordPress Installation
Multisite WordPress Installation
NOTE: Pay close attention, if you use Sub Domains, you will need different code than if you are using Sub Directories.
Sub Directory Installation
Sub Domain Installation
Don’t forget to save and re upload the file when you are done.