- 教学
- 下载
- 作文
- 知识
- 课件
- 教案
概要:Apache服务器的.htaccess是一个非常强大的分布式配置文件,学会使用.htaccess,对虚拟主机用户来说,可以实现众多的功能。这里有一篇很容易让人理解的.htaccess介绍,作为入门文章非常的适合。Part 1 – Introduction介绍 Part 2 - .htaccess Commande命令 Part 3 - Password protection密码保护Part 1 – Introduction介绍Introduction 介绍In this tutorial you will find out about the .htaccess file and the power it has to improve your website. Although .htaccess is only a file, it can change settings on the servers and allow you to do many different things, the most popular being able to have yo
.htaccess使用指南,标签:电脑网络知识,电脑基础教程,http://www.wenxue9.comApache服务器的.htaccess是一个非常强大的分布式配置文件,学会使用.htaccess,对虚拟主机用户来说,可以实现众多的功能。这里有一篇很容易让人理解的.htaccess介绍,作为入门文章非常的适合。
Part 1 – Introduction介绍
Introduction 介绍
In this tutorial you will find out about the .htaccess file and the power it has to improve your website. Although .htaccess is only a file, it can change settings on the servers and allow you to do many different things, the most popular being able to have your own custom 404 error pages. .htaccess isn't difficult to use and is really just made up of a few simple instructions in a text file.
从本指南中,你将可以学习到有关.htaccess文件及其功能的知识,并用以优化你的网站。尽管.htaccess只是一个文件,但它可以更改服务器的设置,允许你做许多不同的事情,最流行的功能是您可以创建自定义的“404 error”页面。.htaccess 并不难于使用,归根结底,它只是在一个text文档中添加几条简单的指令而已。
Will My Host Support It? 我的主机支持它吗?
This is probably the hardest question to give a simple answer to. Many hosts support .htaccess but don't actually publicise it and many other hosts have the capability but do not allow their users to have a .htaccess file. As a general rule, if your server runs Unix or Linux, or any version of the Apache web server it will support .htaccess, although your host may not allow you to use it.
这可能很难用简单的答案来回答。许多主机支持.htaccess,但实际上并不会特别声明,许多其他类型的主机有能力但并不允许他们的用户使用.htaccess。一般来说,如果你的主机使用Unix或Linux系统,或任何版本的Apache网络服务器,从理论上都是支持.htaccess的,尽管你的主机服务商可能不允许你使用它。
A good sign of whether your host allows .htaccess files is if they support password protection of folders. To do this they will need to offer .htaccess (although in a few cases they will offer password protection but not let you use .htaccess). The best thing to do if you are unsure is to either upload your own .htaccess file and see if it works or e-mail your web host and ask them.
判断你的主机是否允许.htaccess,一个标志很好的是它是否支持文件夹密码保护。为达到此功能,主机服务商需要使用.htaccess(当然,少数情况下他们虽提供密码保护功能,但却并不允许你使用.htaccess)。如果你不确定自己的主机是否支持.htaccess,最好的办法是上传你自己的.htaccess文件看看是否有用,或者直接发送e-mail向你的主机服务商咨询。
What Can I Do? 我该怎么做?
You may be wondering what .htaccess can do, or you may have read about some of its uses but don't realise how many things you can actually do with it.
你可能疑惑.htaccess到底能做些什么,或者你可能曾知道它的一些功能但并不真正了解你实际到底可以用它来做多少事情。
There is a huge range of things .htaccess can do including: password protecting folders, redirecting users automatically, custom error pages, changing your file extensions, banning users with certian IP addresses, only allowing users with certain IP addresses, stopping directory listings and using a different file as the index file.
.htaccess可以做大量的事情,包括:文件夹密码保护、用户自动重定向、自定义错误页面、改变你的文件扩展名、封禁特定IP地址的用户、只允许特定IP地址的用户、禁止目录列表,以及使用其他文件作为index文件。
Creating A .htaccess File 创建一个.htaccess文档
Creating a .htaccess file may cause you a few problems. Writing the file is easy, you just need enter the appropriate code into a text editor (like notepad). You may run into problems with saving the file. Because .htaccess is a strange file name (the file actually has no name but a 8 letter file extension) it may not be accepted on certain systems (e.g. Windows 3.1). With most operating systems, though, all you need to do is to save the file by entering the name as:
创建.htaccess文件也许会给你带来一些困难。写文件很容易,你只需要在文字编缉器(例如:写字板)里写下适当的代码。真正困难的可能是文件的保存,因为.htaccess是一个古怪的文件名(它事实上没有文件名,只有一个由8个字母组成的扩展名),而在一些系统(如windows 3.1)中无法接受这样的文件名。在大多数的操作系统中,你需要做的是将文档保存成名为:
".htaccess"
(including the quotes). If this doesn't work, you will need to name it something else (e.g. htaccess.txt) and then upload it to the server. Once you have uploaded the file you can then rename it using an FTP program.
(包括引号)。如果这也不行,你需要将其先命名为其它名字(例如htaccess.txt),再将其上传到服务器上,之后直接使用FTP软件来重命名。