2010-01-21 169 views
0

我試圖使用htaccess重定向,由於某種原因,當我嘗試重定向用戶,而不是去page.html,它試圖去page.htmlpage.htmlpage.htmlpage.html,它只是繼續重複它。任何人有任何線索我的錯誤?Htaccess重定向無法正常工作?

這裏是我的htaccess文件:

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* 

<Limit GET POST> 
order deny,allow 
deny from all 
allow from all 
</Limit> 
<Limit PUT DELETE> 
order deny,allow 
deny from all 
</Limit> 
AuthName 2enetwork.x10hosting.com 
Options All -Indexes 
ErrorDocument 401 /error/401.html 
ErrorDocument 403 /error/403.html 
ErrorDocument 404 /error/404.html 
ErrorDocument 500 /error/500.html 
Redirect/http://2enetwork.tk/under_construction.html 
#RewriteEngine On 
#RewriteRule ^(.*)$ ./under_construction.html [L] 

哦,還有,它會給我一個403錯誤,下面,它說,發現除了302錯誤。如果我評論Redirect/http://2enetwork.tk/under_construction.html,它工作正常。網站沒有問題,我可以看到正在建設中的網頁。

回答

0

好吧,我想出了爲什麼。當我坐在那裏試圖重新定向我的網站時,我將整個網站重定向到uc.html(under_construction.html),並且uc.html包含在網站的其他部分,因此它會嘗試重定向到uc.html再次,再一次,並且再次在永無止境的循環中。所以,我的新問題是,我如何防止這種情況發生?有沒有辦法我可以重定向我的整個網站減uc.html?

0

任何比蠻力「去那裏」更復雜的東西需要mod_rewrite

0

這還沒有測試過,但是......

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !under_construction\.html$ 
RewriteRule ^(.*)$ ./under_construction.html [L] 

此行的RewriteCond告訴它重寫那些以外的所有請求名爲under_construction.html *文件。

*從技術上講,所有以字符串「under_construction.html」結尾的文件。