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

查看:259
本文介绍了将子文件夹重定向到htaccess中的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/

当我键入此URL时,应将其转发到

when I type this url,it should be forwarded to

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

我该怎么做?

推荐答案

避免google重复页面的解决方案包括:

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" />

在页面的标题部分中.有关详细信息,请访问 Google博客

in the head section of your page. Details about this at google blog

除此之外,在Apache级别, DirectoryIndex 指令设置要查找的资源列表(请参见

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  

如果您希望Google看到相同的资源,则应进行客户端重做:

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]

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

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