重定向子文件夹中htacess到的index.html [英] Redirect subfolder to index.html in htacess

查看:149
本文介绍了重定向子文件夹中htacess到的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要子目录(子文件夹)重定向到index.html页面。我怎样才能通过htaccess文件做到这一点。

I have to redirect sub-directory(subfolder) to their index.html page. How can I do it by htaccess file.

例如。

http://www.annonline.com/itineraries-prices/

当我输入这个网址,它应该被转发到

when I type this url,it should be forwarded to

http://www.annonline.com/itineraries-prices/index.html

请建议我怎么能做到这一点?

Please suggest that how can I do this?

在此先感谢。

推荐答案

要避免谷歌有您的网页复制的解决方案是包括:

The solution to avoid google having your page duplicated is to include:

<link rel="canonical" href="http://www.example.com/product.php?item=swedish-fish" />

你的页面在部分。这个在谷歌博客详情

除此之外,在apache的水平,在的DirectoryIndex 指令设置的资源列表来寻找(见的阿帕奇文档
EJ:此指令设置的资源去寻找时,被请求的目录

Aside from this, at apache level, the DirectoryIndex directive sets the list of resources to look for (see apache docs)
Ej: this directive sets the resources to look for when a directory is requested

DirectoryIndex index.php index.html  

如果您希望谷歌看到相同的资源,你应该做一个客户端再导向:

If you want google to see the same resource you should do a client redir:

RewriteRule ^/itineraries-prices/?$ http://www.annonline.com/itineraries-prices/index.html [R=301,L]

这篇关于重定向子文件夹中htacess到的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆