.htaccess files are standard ASCII 'plain text' format files which can be created in Windows NotePad or any standard ASCII text editor. As Microsoft Windows doesn't allow one to easily create file names starting with a . and as NotePad by default will look to append the .txt file extension the path of least resistance when creating .htaccess files in a Windows environment is usually to name the files created in NotePad "htaccess.txt", upload them to your server and then to rename them .htaccess.
Note: An empty .htaccess file will be found on all HostRocket accounts by default so the following procedures will generally only be required when one wishes to upload a .htaccess file to a subdirectory in order to override directives in the /public_html/.htaccess file or to put specific rules in place which will be in effect only in the individual folder. When the goal is to put directives in place which will apply to your entire site globally see the "Modifying .htaccess files" FAQ in this topic area for editing the existing .htaccess file in public_html.
Creating .htaccess files under Microsoft Windows
- Open Windows NotePad via either a Start Menu shortcut or the Run dialog (Click Start > Click Run > Type Notepad > Click OK) - Type or paste the directive you wish to put into effect - Click File > Click Save - Pull down the "Save in" dropdown menu and choose "Desktop" - In the "File name" field type htaccess - Click the Save button
Your .htaccess file should now be saved to your Desktop as a file named htaccess.txt.
Uploading .htaccess files using File Manager
After creating your .htaccess file using the steps above do the following to upload the file using the File Manager utility in your HostRocket control panel:
- Login to your HostRocket Control Panel - Click on the File Manager icon - Find the public_html listing and click on the folder icon next to it - Find the listing for the directory you wish to upload your .htaccess file to and click on the folder icon next to it - Click the Upload Files link - Click the first Browse... button - A Choose File window should appear with a Windows Explorer style interface. Pull down the Look In drop down menu and choose Desktop, which should appear at the very top of the list - Find the htaccess.txt file you created (which may appear as just "htaccess") and Double-Click on it - After the Choose File dialog closes click on the Upload button - In the frame on the left side of the File Manager window you should see \"upload succeeded\" - Find the listing for the htaccess.txt file and click on it - In the left hand frame click on the "Rename File" link - Type .htaccess and click the Rename button
Uploading .htaccess files using FTP
Uploading and renaming the htaccess.txt file via an FTP client one would upload and rename the file in the same manner as any other file. The only thing to be aware of working with .htaccess files via FTP is that as files with names beginning with a . are hidden by default in a Unix environment one may not be able to see an existing .htaccess file (and in most cases at least an 'empty' .htaccess file will be present in the public_html directory on all accounts by default) and/or may not be able to see an uploaded htaccess.txt file once it has been renamed as .htaccess
Some FTP clients provide an option by which one can "unhide" hidden files either via a preference setting or by providing a way of typing the -la command which will disable the hiding of files. See the ReadMe and/or Help file documentation for the specific FTP client for details.