Can I use Apache ".htaccess" files?
Our servers support Apache .htaccess files. If you're experienced with them, you can use them to add password protection to Web pages, control MIME types, change "404 Not Found" messages, redirect visitors to other URLs, deny pages to certain IP addresses, and more. We also have mod_rewrite enabled to allow advanced URL rewriting.
Fully explaining how ".htaccess" files work is beyond the scope of these help pages, but details can be found in the Apache documentation.
We also have pages that explain how to use ".htaccess" files for several common tasks:
- Enabling Directory Listings
- Making Additional Directories Executable
- Using Different Names for Index Files
- Custom Error Pages
- Using php_flag or php_value in .htaccess files
- Redirecting Web Page URLs
- Redirecting www.example.com to example.com (or vice versa)
- Changing the top level directory with .htaccess files
- Protecting Web Images
- Block an IP address
- Preventing Browser Caching
- Increasing Browser Caching
- Using mod_deflate to compress (gzip) files on the fly
If ".htaccess" files are a bit much for you, but all you want to do is password-protect a directory, we have a simple checkbox interface that allows you to manage the password-protection feature of ".htaccess" files. This means you can password-protect directories on your Web site without learning how ".htaccess" files work.
Naming and formatting .htaccess files
One thing that first confuses people who use ".htaccess" files is the unusual name. The name of the file, when placed on our servers, must be exactly this:
... starting with a dot, all lowercase. Although the file is plain text and can be created in any text editor, the filename should not be ".htaccess.txt": it should just be ".htaccess". If your text editor saves it as ".htaccess.txt", be sure to rename it when you put it on the Web server. (If you use Windows, it may help to show file extensions.)
Also, the file must be plain text, not an HTML document, Word document, RTF document, or any other format. Be sure your text editor saves the file as plain text and that you upload it in "text mode" (not "binary mode") if you use an FTP program.
Finally, note that the ".htaccess" file doesn't exist until you first create it. It's normal to not see any ".htaccess" file for your site until you upload one yourself.