.htaccess

From Hostek.com Wiki
Revision as of 22:38, 4 July 2014 by Coryme (Talk | contribs)

Jump to: navigation, search

Can I use a .htaccess file to password protect a directory?

Yes, on our LINUX servers you can use a .htaccess file to password protect a directory.

The code to perform this is:

AuthUserFile /usr/local/you/safedir/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user wsabstract

Change the File directory to the directory listed in your File Manager.

Enabling Case Insensitive URLs for my Linux site

Add the following to your .htaccess file:

CheckSpelling on

Rewriting all URL requests to WWW.

Add the following to your .htaccess code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Rewriting HTTP requests to HTTPS

Add the following to your .htaccess code:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://yourdomain/$1 [R,L]