|
|
|
Please note that .htaccess files affect ALL subdirectories of the folder it is placed into.
To create a .htaccess file in windows, use notepad to create a new document, and save it as htaccess.txt. When you have uploaded it to the server, simply rename it .htaccess
Once uploaded, the .htaccess file may disappear from view, this is because it is a hidden file, and some FTP clients do not automatically show hidden files.
ErrorDocument
To make your own custom error pages, create a new document in notepad, and enter the following line:
ErrorDocument XXX /path to your/errordocument.ext
Where
XXX - is the errordocument you want to replace i.e.
401 Not authorised
403 Forbidden
404 Page not found
/path to your/errordocument - is the path to your error page relative to the httpdocs folder (ie /error/404.php)
and .ext is the extension you want the page to have, i.e.
.html
.php
Save the file as htaccess.txt, upload it to your httpdocs folder, and rename it to .htaccess
Example:
ErrorDocument 404 /error/404.php
Note:
You cannot call the directory where you store your error pages error_docs
Tips
Other useful .htaccess tips
If you've uploaded an .htaccess file, and you can't see it in your FTP client, then you will need to add a filter. Somewhere in the settings, there will be an option to add a remote filter, you need to add -a which will tell your FTP client to show hidden files (on 34SP servers, files starting with a . are hidden).
To make a directory show a list of files, rather than auto-load an index file, put the following line into an .htaccess file in the directory you want to 'index':
Options +Indexes
To change the default index file for a directory, put this line:
DirectoryIndex somefile.ext
Where somefile is your filename, and ext is the file extension (php, html)
Example:
DirectoryIndex home.php
To run PERL scripts outside the cgi-bin, put this line into the .htaccess file for the directory where you want to run the PERL script:
Options +ExecCGI
AddHandler cgi-script .cgi .pl
To block a certain IP from viewing a folder (or your whole site), you need to add the following lines:
Order Allow,Deny
Allow from all
Deny from IP.TO.BLOCK
Where IP.TO.BLOCK is the IP address you wish to stop accessing your site/folder
 |
|
|
|
There are no related articles
|
|
|