. Introduction and creation of the Htaccess tutorial. httacces file _linux

Source: Internet
Author: User
Tags microsoft frontpage password protection
1. What is a. htaccess file
From this guide, you will be able to learn about. htaccess files and their functions, and use them to optimize your site. Although. htaccess is just a file, it can change the settings of the server, allow you to do many different things, the most popular feature is that you can create a custom "404 error" Page ... htaccess is not difficult to use, in the final analysis, It just adds a few simple instructions to a text document.

First you have to judge the host to support it

This may be difficult to answer with a simple answer. Many hosts support. htaccess, but in practice it is not specifically stated that many other types of hosts are capable but do not allow their users to use. htaccess. In general, if your host uses UNIX or Linux systems, or any version of the Apache Web server, it is theoretically supported. htaccess, although your hosting provider may not allow you to use it.

Determine if your host is allowed. htaccess, a flag is good whether it supports folder password protection. To achieve this, the host service provider needs to use. htaccess (of course, in a few cases they provide password protection, but they do not allow you to use. htaccess). If you are unsure if your host is supported. htaccess, the best way is to upload your own. htaccess file to see if it's useful, or send an e-mail directly to your host provider for advice.

The. htaccess file (or distributed configuration file) in the Apache system provides a way to configure changes to the directory, that is, to place a file containing one or more directives in a specific document directory to function in this directory and all its subdirectories. As a user, the commands you can use are limited. The administrator can set it through the Apache allowoverride directive.

The directives in the subdirectory overwrite the instructions in the higher-level directory or the primary server configuration file.

. htaccess must be uploaded in ASCII mode, preferably with the permissions set to 644.

Htaccess can do a lot of things, including: folder password protection, user automatic redirection, custom error pages, changing your file name extension, banning specific IP addresses, allowing only users with specific IP addresses, prohibiting directory listings, and using other files as index files.

2. How to create a. httaccess file
Creating a. htaccess file may cause some difficulties for you. Writing a file is easy, and you just need to write the appropriate code in a word editor (e.g., WordPad). The real difficulty may be the preservation of the file because. htaccess is an odd file name (it actually has no file name, only a 8-letter extension) and cannot be accepted in some systems (such as Windows 3.1). In most operating systems, what you need to do is save the document to fame as:

". htaccess"

(including quotes). If that doesn't work, you'll need to name the first other names (such as Htaccess.txt), upload them to the server, and then rename them directly using the FTP software.

Warning

Before using. htaccess, I must give you some warning. Although it is used on the server. Htaccess is absolutely unlikely to cause you any trouble (if something is wrong, it just doesn't work), but you have to be particularly careful if you use Microsoft FrontPage Extensions. Because FrontPage extensions itself uses. htaccess, you can't edit it and add your own information. If you do have this need (not recommended, but possible), you should download from the server first. htaccess document (if present), then precede with your code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.