HTTP and HTTPS w/ www Redirect via .htaccess

So every now and then I run into an issue where I need to setup redirects for addon domains.  Here is one method that has always worked for me.  Adding it in this way allows for https and non http and also handles non-www and www to redirect to the www.newdomain.com...

Directory Protection for WordPress via .htaccess

So I have found that the regular Directory Protection feature in CPanel does not work straight out of the box with WordPress installs.  In the below code after you setup a protection through CPanel you can take the provided data and customize it to match what is...

Directory Protection Minus Specific Files/Folders

Here is some code I found that can be used to protect a directory but tell the server to still allow access to specific files and folders. SetEnvIf Request_URI “(path/to/folder/)$” allow SetEnvIf Request_URI “(path/to/file\.php)$” allow Order...

Get Contents via cURL

So I have ran into an issue where a site was using URL's in the file_get_contents function and stopped working on the server.  This was also an issue if anyone was trying to do a URL include within a require() or an include(). Here was a solution that I found that...

HTTP to HTTPS Redirect via HTAccess

So to have an entire site get redirected from HTTP to HTTPS you can use the following redirect code within the .htaccess file. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] and to go in reverese RewriteEngine On...