ErrorDocument 404 /404.html
保存成.htaccess文件上傳到網站的根目錄。
/404.html是目錄名和文件名,能夠改爲本身的名字。
QUOTE:
.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 thepower it has to improve your website. Although .htaccess is only afile, it can change settings on the servers and allow you to domany different things, the most popular being able to have your owncustom 404 error pages. .htaccess isn't difficult to use and isreally just made up of a few simple instructions in a textfile.
從本指南中,您能夠學習到有關.htaccess文檔及其功能,用以優化您的網站。儘管.htaccess只是一個文檔,但它能夠更改服務器的設置,容許您作許多不一樣的事情,最流行的功能是您能夠建立自定義的「404error」頁面。.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 andmany other hosts have the capability but do not allow their usersto have a .htaccess file. As a general rule, if your server runsUnix 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 theysupport password protection of folders. Todo this they will need to offer .htaccess (although in a few casesthey 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 askthem.
你的主機是否容許.htaccess,很好的一個標誌是它是否支持文件夾的密碼保護。爲此,他們將提供.htaccess支持(儘管少數狀況下他們提供密碼保護功能但不容許你使用.htaccess)。若是你不肯定,最好的辦法一是上傳你本身的.htaccess文檔看看是否有用,二是e-mail給你的主機服務商詢問。
What Can I Do? 我該怎麼作?
You may be wondering what .htaccess can do, or you may have readabout some of its uses but don't realise how many things you canactually 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 userswith certian IP addresses, only allowing users with certain IPaddresses, stopping directory listings and using a different fileas the index file.
.htaccess能夠作大量範圍的事情,包括:文件夾密碼保護、用戶自動從新指向、自定義錯誤頁面、變動你的文件擴展名、屏蔽特定的用戶IP地址、只容許特定的IP地址、中止目錄表以及使用其餘文件做爲index文件。
Creating A .htaccess File 建立一個.htaccess文檔
Creating a .htaccess file may cause you a few problems. Writing thefile is easy, you just need enter the appropriate code into a texteditor (like notepad). You may run into problems with saving thefile. Because .htaccess is a strange file name (the file actuallyhas no name but a 8 letter file extension) it may not be acceptedon certain systems (e.g. Windows 3.1). With most operatingsystems, though, all you need to do is to save the file by enteringthe name as:
建立.htaccess文檔也許會給你帶來幾個問題。寫文檔很容易,你只須要在文字編緝器(例如:寫字板)裏寫下適當的代碼。而後,你可能會遇到保存文檔的困難,由於.htaccess是一個古怪的文件名(文檔事實上沒有文件名,只有一個由8個字母組成的擴展名),一些系統(例如windows3.1)沒法接受這樣的文件名。在大多數的操做系統中,你須要作的是將文檔保存成名爲:
".htaccess"
(including the quotes). If this doesn't work, you will need to nameit something else (e.g. htaccess.txt) and then upload it to theserver. Once you have uploaded the file you can then rename itusing an FTP program.
(包括引號)。若是這也不行,你須要將其命名爲其餘的名字(例如htaccess.txt),再將其上傳到服務器上,此後你就能夠利用FTP軟件來重命名它了。
Warning 警告
Before beginning using .htaccess, I should give you one warning.Although using .htaccess on your server is extremely unlikely tocause you any problems (if something is wrong it simply won'twork), you should be wary if you are using the Microsoft FrontPageExtensions. The FrontPage extensions use the .htaccess file so youshould not really edit it to add your own information. If you dowant to (this is not recommended, but possible) you should downloadthe .htaccess file from your server first (if it exists) and thenadd your code to the beginning.
在使用.htaccess以前,我必須給你一些警告。儘管在服務器上使用.htaccess絕對不太可能給你帶來任何麻煩(若是有些東西錯了,它只是沒效用罷了),但若是你使用MicrosoftFrontPage Extensions你就須要當心些。FrontPageExtensions使用了.htaccess,所以你不能編輯它,加入你本身的信息。若是你須要(並不推薦,可是可能)你應該先從服務器上下載.htaccess文檔(若是存在),以後在前面加上你的代碼。
Custom Error Pages 自定義錯誤頁
The first use of the .htaccess file which I will cover is customerror pages. These will allow you to have your own, personal errorpages (for example when a file is not found) instead of using yourhost's error pages or having no page. This will make your site seemmuch more professional in the unlikely event of an error. It willalso allow you to create scripts to notify you if there is an error(for example I use a PHP script on Free Webmaster Help toautomatically e-mail me when a page is not found).
我想介紹的.htaccess第一個應用是自定義錯誤頁面,這使得你能夠擁有本身的、個性化的錯誤頁面(例如找不到文件時),而不是你的服務商提供的錯誤頁或沒有任何頁面。這會讓你的網站在出錯的時候看上去更加專業。你還能夠利用腳本程序在發生錯誤的時候通知你(例如我使用FreeWebmaster Help的PHP腳本程序,當找不到頁面的時候自動e-mail給我)。
You can use custom error pages for any error as long as you knowits number (like 404 for page not found) by adding the following toyour .htaccess file:
任何你知道代碼的錯誤(像404找不到頁面),你均可以將其變成自定義頁面,要作的只是在.htaccess文件里加入如下一段:
ErrorDocument errornumber /file.html
For example if I had the file notfound.html in the rootdirect
ory of my site and I wanted to use it for a 404 error I woulduse:
例如,若是個人根目錄下有一個nofound.html文檔,我想使用它做爲404error的頁面:
ErrorDocument 404 /notfound.html
If the file is not in the root directory of your site, you justneed to put the path to it:
若是文件不在網站的根目錄下,你只須要把路徑設置爲:
ErrorDocument 500 /errorpages/500.html
These are some of the most common errors:
如下是一些最經常使用的錯誤:
401 - Authorization Required
400 - Bad request
403 - Forbidden
500 - Internal Server Error
404 - Wrong page
Then, all you need to do is to create a file to display when theerror happens and upload it and the .htaccess file.
這樣,你要作的只是生成一個錯誤顯示文檔,而後把它們上傳。
Part 2 - .htaccess 命令
Introduction 介紹
In the last part I introduced you to .htaccess and some of itsuseful features. In this part I will show you how to use the.htaccess file to implement some of these.
上一部分中我已經將你引入了.htaccess以及它的一些有用的功能,在這一部分裏,我將向您演示如何應用.htaccess文檔去實現這些功能。
Stop A Directory Index From Being Shown 停示顯示目錄索引
Sometimes, for one reason or another, you will have no index filein your directory. This will, of course, mean that if someone typesthe directory name into their browser, a full listing of all thefiles in that directory will be shown. This could be a securityrisk for your site.
有些時候,因爲某種緣由,你的目錄裏沒有index文件,固然這樣意味着若是有人在瀏覽器地址欄鍵入了該目錄的路徑,該目錄下全部的文件都會顯示出來,這形成了網站的安全威脅。
To prevent against this (without creating lots of new 'index'files, you can enter a command into your .htaccess file to stop thedirectory list from being shown:
爲了不這種狀況(而沒必要建立一堆的新index文檔),你能夠在你的.htaccess文檔中鍵入如下命令,用以阻止目錄索引的顯示:
Options -Indexes
Deny/Allow Certian IP Addresses 阻止/容許特定的IP地址
In some situations, you may want to only allow people with specificIP addresses to access your site (for example, only allowing peopleusing a particular ISP to get into a certian directory) or you maywant to ban certian IP addresses (for example, keeping disruptivememembers out of your message boards). Of course, this will onlywork if you know the IP addresses you want to ban and, as mostpeople on the internet now have a dynamic IP address, so this isnot always the best way to limit usage.
有些狀況下,你可能只想容許某些特定IP的用戶能夠訪問你的網站(例如:只容許使用特定ISP的用戶進入某個目錄),或者你想攔截某些特定的IP地址(例如:將低級用戶隔離於你的信息面版外)。固然,這隻在你知道你想攔截的IP地址時纔有用,然而如今網上的大多數用戶都使用動態IP地址,因此這並非限制使用的經常使用方法。
You can block an IP address by using:
你可使用如下命令攔截一個IP地址:
deny from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2of the groups of numbers, you will block a whole range.
被攔截的IP地址則爲000.000.000.000,若是你只指定其中1或2個代碼組,你能夠攔截整個區域的地址。
You can allow an IP address by using:
你可使用如下命令容許一個IP地址的訪問:
allow from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2of the groups of numbers, you will allow a whole range.
被容許的IP地址則爲000.000.000.000,若是你只指定其中1或2個代碼組,你能夠容許整個區域的地址。
If you want to deny everyone from accessing a directory, you canuse:
若是你想阻止全部人訪問該文件目錄,你可使用:
deny from all
but this will still allow scripts to use the files in thedirectory.
但這將仍然容許腳本程序使用這個目錄下的文檔。
Alternative Index Files 替代的index文檔
You may not always want to use index.htm or index.html as yourindex file for a directory, for example if you are using PHP filesin your site, you may want index.php to be the index file for adirectory. You are not limited to 'index' files though. Using.htaccess you can set foofoo.blah to be your index file if you wantto!
也許你不想一直使用index.htm或index.html來做爲目錄的索引文檔,例如你的站點使用PHP文檔,你會想使用index.php來做爲該目錄的索引文檔。固然也沒必要侷限於「index」文檔,若是你願意,你儘管使用foofoo.balh來做爲你的索引文檔!
Alternate index files are entered in a list. The server will workfrom left to right, checking to see if each file exists, if none ofthem exisit it will display a directory listing (unless, of course,you have turned this off).
替代的索引文檔能夠排成一個列表,服務器會從左至右進行尋找,看看哪一個文檔在真實的目錄中存在。若是一個也找不到,它將會把目錄清單顯示出來(固然除非你關閉了顯示目錄文件清單)。
DirectoryIndex index.php index.php3 messagebrd.pl index.htmlindex.htm
Redirection 從新指向
One of the most useful functions of the .htaccess file is toredirect requests to different files, either on the same server, oron a completely different web site. It can be extremely useful ifyou change the name of one of your files but allow users to stillfind it. Another use (which I find very useful) is to redirect to alonger URL, for example in my newsletters I can use a very shortURL for my affiliate links. The following can be done to redirect aspecific file:
.htaccess其中一個極其有用的功能,就是將請求從新指向站內或站外的不一樣文檔。當你改變了一個文檔名稱時但仍然想讓用戶仍然能夠用舊連接找到它,這個時候此功能將變得極其有用。另外一個應用(我發現的頗有用的)是從新指向一個長URL,例如在個人時事信息中,我可使用一個很簡短的URL來指向個人聯合連接。如下是一個從新指向特定文檔的例子:
Redirect /location/from/root/file.ext http://www.othersite.com/new/file/location.xyz
In this above example, a file in the root directory calledoldfile.html would be entered as:
上述的例子中,訪問在root目錄下的名爲oldfile.html能夠鍵入:
/oldfile.html
and a file in the old subdirectory would be entered as:
訪問一箇舊次級目錄中的文件能夠鍵入:
/old/oldfile.html
You can also redirect whole directoires of your site using the.htaccess file, for example if you had a directory calledolddirectory on your site and you had set up the same files on anew site at: http://www.newsite.com/newdirectory/ you couldredirect all the files in that directory without having to specifyeach one:
你也可使用.htaccess將整個網站的目錄都作從新指向,假如你的網站上有一個名爲olddirectory的目錄,而且你已經在一個新網站http://www.newsite.com/newdirectory/上創建了與上相同的文檔,你能夠將舊目錄下全部的文件作一次從新指向而沒必要一一聲明:
Redirect /olddirectory http://www.newsite.com/newdirectory
Then, any request to your site below /olddirectory will beeredirected to the new site, with the
extra information in the URL added on, for example if someone typedin:
這樣,任何指向到站點中/olddirectory的請求都將被從新指向新的站點,包括附加的額外URL信息。例若有人鍵入:
They would be redirected to:
請求將被從新指向到:
This can prove to be extremely powerful if used correctly.
若是正確使用,本功能將極其強大。
Part 3 – 密碼保護
Introduction 介紹
Although there are many uses of the .htaccess file, by far the mostpopular, and probably most useful, is being able to relaiblypassword protect directories on websites. Although JavaScript etc.can also be used to do this, only .htaccess has total security (assomeone must know the password to get into the directory, there areno 'back doors')
儘管有各類各樣的.htaccess用法,但至今最流行的也多是最有用的作法是將其用於網站目錄的可靠的密碼保護。儘管JavaScrip等也能作到,但只有.htaccess具備完美的安全(即訪問者必須知曉密碼才能夠訪問目錄,而且絕無「後門」可走)。
The .htaccess File
Adding password protection to a directory using .htaccess takes twostages. The first part is to add the appropriate lines to your.htaccess file in the directory you would like to protect.Everything below this directory will be password protected:
利用.htaccess將一個目錄加上密碼保護分兩個步驟。第一步是在你的.htaccess文檔里加上適當的幾行代碼,再將.htaccess文檔放進你要保護的目錄下:
AuthName "Section Name"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
Require valid-user
There are a few parts of this which you will need to change foryour site. You should replace "Section Name" with the name of thepart of the site you are protecting e.g. "Members Area".
有幾個小部分你可能須要根據你的網站狀況而修改一下。用被保護部分的名字替換掉」Section Name」,例如"MembersArea"。
The /full/parth/to/.htpasswd should be changed to reflect the fullserver path to the .htpasswd file (more on this later). If you donot know what the full path to your webspace is, contact yoursystem administrator for details.
另外/full/parth/to/.htpasswd應該替換爲指向.htpasswd文檔(後面詳述該文檔)的完整服務器路徑。若是你不知道你網站空間的完整路徑,詢問一下你的系統管理員。
The .htpasswd File
Password protecting a directory takes a little more work than anyof the other .htaccess functions because you must also create afile to contain the usernames and passwords which are allowed toaccess the site. These should be placed in a file which (bydefault)should be called .htpasswd. Like the .htaccess file, this is a filewith no name and an 8 letter extension. This can be placed anywherewithin you website (as the passwords are encrypted) but it isadvisable to store it outside the web root so that it is impossibleto access it from the web.
目錄的密碼保護比.htaccess的其餘功能要麻煩些,由於你必須同時建立一個包含用戶名和密碼的文檔,用於訪問你的網站,相關信息(默認)應位於一個名爲.htpasswd的文檔裏,像.htaccess同樣,.htpasswd也是一個沒有文件名且具備8位擴展名的文檔,能夠放置在你網站裏的任何地方(此時密碼應加密),但建議你將其保存在網站根目錄外,這樣經過網絡就沒法訪問到它了。
Entering Usernames And Passwords 輸入用戶名和密碼
Once you have created your .htpasswd file (you can do this in astandard text editor) you must enter the usernames and passwords toaccess the site. They should be entered as follows:
建立好.htpasswd文檔後(能夠經過文字編輯器建立),下一步是輸入用於訪問網站的用戶名和密碼,應爲:
username:password
where the password is the encrypted format of the password. Toencrypt the password you will either need to use one of the premadescripts available on the web or write your own. There is a goodusername/password service at the KxS site which will allow you toenter the user name and password and will output it in the correctformat.
「password」的位置應該是加密過的密碼。你能夠經過幾種方法來獲得加密過的密碼:一是使用一個網上提供的permade腳本或本身寫一個;另外一個很不錯的username/password加密服務是經過KxS網站,這裏容許你輸入用戶名及密碼,而後生成正確格式的密碼。
For multiple users, just add extra lines to your .htpasswd file inthe same format as the first. There are even scripts available forfree which will manage the .htpasswd file and will allow automaticadding/removing of users etc.
對於多用戶,你只須要在.htpasswd文檔中新增一樣格式的一行便可。另外還有一些免費的腳本程序能夠方便地管理.htpasswd文檔,能夠自動新增/移除用戶等。
Accessing The Site 訪問網站
When you try to access a site which has been protected by .htaccessyour browser will pop up a standard username/password dialog box.If you don't like this, there are certain scripts available whichallow you to embed a username/password box in a website to do theauthentication. You can also send the username and password(unencrypted) in the URL as follows:
當你試圖訪問被.htaccess密碼保護的目錄時,你的瀏覽器會彈出標準的username/password對話窗口。若是你不喜歡這種方式,有些腳本程序能夠容許你在頁面內嵌入username/password輸入框來進行認證,你也能夠在瀏覽器的URL框內以如下方式輸入用戶名和密碼(未加密的):
http://username:password@www.website.com/directory/
Summary 小結
.htaccess is one of the most useful files a webmaster can use.There are a wide variety of different uses for it which can savetime and increase security on your website.
.htaccess是一個站點管理員能夠應用的一個強大的工具,有更多的變化以適應不一樣的用途,能夠節約時間及提升網站的安全性。
php
在「經過HTTP狀態碼查看搜索引擎蜘蛛如何爬行你的網站」一文中,我介紹了一些常常涉及到的HTTP狀態碼及含義,譬如你們常常探討而且與本文相關的Http狀態碼: 404:服務器找不到指定的資源,請求的網頁不存在(譬如瀏覽器請求的網頁被刪除或者移位,但不排除往後該連接有效的可能性); 410:請求的網頁不存在(注意:410表示永久性,而404表示臨時性); 200:服務器成功返回請求的網頁; 301:網址永久性重定向 302:網址臨時性重定向 注意:大部分搜索引擎將「404」與「410」狀態同等對待,如Google。(參見Matt Cutts的說明) 對HTTP404狀態碼的理解 HTTP 404錯誤意味着連接指向的網頁不存在,即原始網頁的URL失效,這種狀況常常會發生,很難避免,好比說:網頁URL生成規則改變、網頁文件改名或移動位置、導入連接拼寫錯誤等,致使原來的URL地址沒法訪問;當Web服務器接到相似請求時,會返回一個404狀態碼,告訴瀏覽器要請求的資源並不存在。可是,Web服務器默認的404錯誤頁面,不管Apache仍是IIS,均十分簡陋、呆板且對用戶不友好,沒法給用戶提供必要的信息以獲取更多線索,無疑這會形成用戶的流失。 所以,不少網站均使用自定義404錯誤的方式以提供用戶體驗避免用戶流失。通常而言,自定義404頁面通用的作法是在頁面中放置網站快速導航連接、搜索框以及網站提供的特點服務,這樣能夠有效的幫助用戶訪問站點並獲取須要的信息。 HTTP404對SEO的影響 自定義404錯誤頁面是提供用戶體驗的很好的作法,但在應用過程當中每每並未注意到對搜索引擎的影響,譬如:錯誤的服務器端配置致使返回「200」狀態碼或自定義404錯誤頁面使用MetaRefresh致使返回「302」狀態碼。正確設置的自定義404錯誤頁面,不只應當可以正確地顯示,同時,應該返回「404」錯誤代碼,而不是「200」或「302」。雖然對訪問的用戶而言,HTTP狀態碼到底是「404」仍是「200」來講並無什麼區別,但對搜索引擎而言,這則是至關重要的。 (一)自定義404錯誤頁返回「200」狀態碼 當搜索引擎蜘蛛在請求某個URL時獲得「404」狀態迴應時,即知道該URL已經失效,便再也不索引該網頁,並向數據中心反饋將該URL表示的網頁從索引數據庫中刪除,固然,刪除過程有可能須要很長時間;而當搜索引擎獲得「200」狀態迴應時,則會認爲該url是有效的,便會去索引,並會將其收錄到索引數據庫,這樣的結果即是這兩個不一樣的url具備徹底相同的內容:自定義404錯誤頁面的內容,這會致使出現複製網頁問題。對搜索引擎而言,特別是Google,不但很難得到信任指數TrustRank,也會大大下降Google對網站質量的評定。(爲何會出現返回「200」狀態碼的狀況??請參看下面內容「自定義404錯誤頁面的基本原則」) 我一直在使用GoogleSitemap,當咱們提交XML格式網站地圖文件時,Google會驗證咱們的身份以確保是網站合法的管理者。驗證方式有兩種:上傳指定名稱的html頁到網站根目錄或者在網頁meta區域添加一個標識身份的meta標籤。我一般是使用上傳html網頁的方式,但Google卻提示我網站根目錄下找不到這個網頁(實際上我已上傳,而且經過瀏覽器能夠訪問),這是一個很可怕的問題,見圖: (二)自定義404錯誤頁使用Meta Refresh返回「302」狀態碼 經常看到許多網站的自定義404錯誤頁面採起相似這樣的形式:首先顯示一段錯誤信息,而後,經過MetaRefresh將頁面跳轉到網站首頁、網頁地圖或其餘相似頁。根據具體實現方式不一樣,這類404頁面可能返回「200」狀態碼,也可能返回「302」,但不論哪一種,從SEO技術角度看,均不是一種合適的選擇。 對「200」狀態的狀況咱們上面已經談過,那麼,當404頁面返回「302」時,搜索引擎會怎麼對待呢?從理論上說,對「302」錯誤,搜索引擎認爲該網頁是存在的,只不過臨時改變了地址,仍然會索引收錄該頁,這樣,一樣會出現相似於「200」狀態碼時的重複文本問題;其次,以google爲表明的主流搜索引擎對302重定向的適用範圍要求愈來愈嚴格,這類不當使用302重定向的狀況存在很大的風險。 確保自定義404錯誤頁面可以返回「404」狀態碼 在自定義404錯誤頁面設置完畢後,必定要檢查一下其是否是可以正確地返回「404」狀態碼。可使用ServerHeader檢查工具,輸入一個不存在網頁的url,查看一下HTTP Header的返回狀況,確信其返回的是「404 Notfound」。 404錯誤的處理方式 (一)定製404錯誤頁面的基本原則 首先應明確的是,404錯誤應工做在服務器級而不是網頁級。對定製使用動態頁面如PHP腳本類型的404頁時,必須確保在PHP執行前服務器已經順利地送出「404」狀態碼,否則,一旦執行到了ISAPI級別,返回的狀態碼便只能是「200」或其餘如「302」之類的重定向狀態碼了。 其次,在自定義網站的404錯誤頁面時,對設置的錯誤頁面URL連接應使用相對路徑而不是絕對路徑,並且自定義404頁面應該放在網站根目錄下。儘管無效連接多是多種形式的URL,但當發生404訪問錯誤時,WEB服務器會自動將其轉到自定義的當404錯誤頁中,這跟URL的形似沒有關係。 (二)Apache下設置404錯誤頁面 爲Apache Server設置 404錯誤頁面的方法很簡單,只需在.htaccess 文件中加入以下內容便可: ErrorDocument 404 /notfound.php 注意: 1.切記不要將404錯誤轉向到網站主頁,不然可能會致使主頁在搜索引擎中消失 2.切記不要使用絕對URL(例如:http://www.bloghuman.com/nofound.php形式),若是使用絕對URL返回的狀態碼是「302」+「200」(已測試)(三)IIS/ASP.net下設置404錯誤頁面首先,修改應用程序根目錄的設置,打開 「web.config」 文件編輯,在其中加入以下內容:<configuration><system.web><customErrors mode=」On」 defaultRedirect=」error.asp」><error statusCode=」404″ redirect=」notfound.asp」 /></customErrors></system.web></configuration>注:上文例中「error.asp」爲系統默認的404頁面,「notfound.asp」爲自定義的404頁面,使用時請修改相應文件名。而後,在自定義的404頁面「notfound.asp」中加入:<%Response.Status = 「404 Not Found」%>這樣,即可以保證IIS可以正確地返回「404」狀態碼(四)在IIS/ASP.net下設置404靜態頁面設置靜態404錯誤頁面的方法則比較簡單,在IIS管理器中右鍵單擊要管理的網站,打開「屬性」中的「自定義錯誤信息」頁,爲「404」設定相應的錯誤信息頁便可 |