Useful htaccess Commands For WordPress

The .htaccess file, it is a small text file that holds commands that tells your website to do or not do certain things. These commands can be super helpful for example if you want to move all your affiliate links into a new directory, you could write a command to do it instead of manually changing links. And the more common task when it comes to WordPress, it is the file that holds the commands to make your URLs nice and readable.

Beyond that, on many WordPress installs, I also have a list of other commands running to help with various tasks. Here are some of them.

Close WordPress Site

This is great so you can work on it or keep people from snooping on a new project. There are plugins that you can use to shut down your site but many of them only create a mask. They don’t really shut off access and people can still login. This keeps people out by IP and show everyone else a message (see the reference to Upgrade.html) in there? You’d need to create a page, name it Upgrade.html, save it in the same folder, and enter your message there.

https://gist.github.com/lynettechandler/6511765

Prevent Scripts From Running In Uploads Folder

Since the uploads folder are usually media or zip files, you can create an .htaccess file inside your uploads folder and drop this in.

https://gist.github.com/lynettechandler/6513323

Lock Down Config And Other Files

https://gist.github.com/lynettechandler/6513640

Lock Login and WP-Admin For All But Selected IP

This is helpful when you are the only one editing your site. You can also easily add other people’s IP addresses (if you have VA’s) by repeating the IP line. Just remember most people’s IP addresses change so you will need to log in to cPanel or FTP to edit the htaccess when this happens.

The first set will go into the .htaccess file inside the wp-admin folder. Create the file if not there. The second can be entered into the .htaccess in your main wp folder – the same place where wp-config.php is.

https://gist.github.com/lynettechandler/6513803

Do You Want A Hands-Free Business?

Then get this guide to help you systemize your business so you'll have more time working on your business.

!
!

Hey! I want to make sure you know what you're getting here. In addition to the guide, you will also receive our memo that includes special offers, announcements and of course actionable information.

Terms and Conditions checkbox is required.
Something went wrong. Please check your entries and try again.
Facebook Comments