2016-11-03 63 views

回答

1

創建於一個htaccess文件,並添加以下內容:

RewriteEngine on 

RewriteRule ^$ /index.html [L,R] 

取出[R標誌,如果想在內部重定向(不改變URL)/子/index.html

+0

這樣做。非常感謝!我有一個後續問題。你更喜歡哪種方式重定向。使用.htaccess或每個子文件夾中的index.html文件使用此代碼行 Dreni

+1

@Dreni htaccess重定向更好元。當服務器直接向客戶端發送重定向時,速度更快。 – starkeen

+1

編輯最後評論的時間太晚了。你可以閱讀這[這是更好的元刷新網址重定向或htaccess的301重定向](http://stackoverflow.com/questions/10601881/which-is-better-meta-refresh- url-redirect-or-htaccess-301-redirect) – starkeen

0

這是爲你工作嗎?

RewriteRule ^/subfolder/?$ http://yourdomain.com/index.html [R=301,L] 
相關問題