2013-05-31 79 views
0

我想從所有頁面重定向到目錄中的索引頁面。 也是錯誤的地址。htaccess如何將目錄中的所有頁面重定向到索引頁面

http://site.com/directory/anyword move to http://site.com/directory/index.html 

我的確在.htaccess RedirectMatch 301 /directory /directory/index.html

但我需要不同的目錄/ thankyou.html

它重定向但不打開index.html - resulted in too many redirects

也許我可以試試與404相匹配。

回答

0

您需要從匹配項中排除index.html,否則將得到一個無限循環,其中directory/index.html將重定向到其自身ver和over。

不幸的是我的寫作.htaccess文件的知識基本上不存在,所以我不能提供一個例子。

0

Mod重寫?

RewriteEngine On 
RewriteCond %{REQUEST_URI} !index\.html$ 
RewriteRule /directory/.+ /directory/index.html 
+0

沒有。如果地址錯誤(目錄/ ddkdfjskdjsdkdj),則會打開404頁面 – Dobrozhelatel

相關問題