recently in the use of php+mysql space station www.kingwq.cn, a problem first discovered by the program directory is listed on the occasion, depressed consult our foreign teacher, GG, that is.Htaccess file problems, summed up online for detailed documentation.Htaccess. Now share with you.
if the column directory of the web site is created, create a file.Htaccess file in the root of the web site.
creates a.Htaccess file, now creates a text document locally, then writes the following command in the document, uploads it to the FTP space, and changes the name in the FTP space.
prohibits files listing directories.
sometimes, when a user enters a directory in the browser, all the files in this directory are listed, which is obviously a security risk. To keep the file out, you can add the following command in the.Htaccess file: Options -Indexes
allows / shields specific IP addresses.
sometimes wants to allow or block access to a directory for certain IP addresses, using deny from 000.000.000.000 or allow from 000.000.000.000. To screen all IP addresses, use deny from all.
specifies additional index files.
if you are developing your PHP website, then your home file may be index.php to index.php as the default home page, the website with the command: DirectoryIndex index.php index.php3 messagebrd.pl index.html index.htm. The server or check the directory from right to see if the file exists, and if found, use that file as the default home page.
The best thing about a
.Htaccess file is that you can turn any request to a different directory, file (even if the file and directory are not on the same server).
Redirect /olddirectory http://s.newsite.com/newdirectory.
custom error pages.
uses.Htaccess files, and can also point to the pages of the server’s various error messages. For example, the file was not found, it was a 404 error. Use the following