2013-05-31 80 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

相关问题