Apache 将子文件夹重定向到htaccess中的index.html

Apache 将子文件夹重定向到htaccess中的index.html,apache,.htaccess,Apache,.htaccess,我必须将子目录(子文件夹)重定向到他们的index.html页面。我如何通过htaccess文件来实现它 e、 g 当我键入此url时,它应转发到 如何做到这一点?避免谷歌复制您的页面的解决方案包括: <link rel="canonical" href="http://www.example.com/product.php?item=swedish-fish" /> 如果您想让google看到相同的资源,您应该进行客户端重读: RewriteRule ^/itinerarie

我必须将子目录(子文件夹)重定向到他们的index.html页面。我如何通过htaccess文件来实现它

e、 g

当我键入此url时,它应转发到


如何做到这一点?

避免谷歌复制您的页面的解决方案包括:

<link rel="canonical" href="http://www.example.com/product.php?item=swedish-fish" />
如果您想让google看到相同的资源,您应该进行客户端重读:

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

你为什么需要这个?通常,当你进入那个目录时,index.html应该被自动调用。我也必须在url中显示index.html。Bcoz谷歌为同一个文件读取两个url:“annonline.com/itineries prices/”;和“annonline.com/itineries prices/index.html”;-Amit Jha 10分钟这就是
rel=canonical
的目的,但是重写是可以完成的,而且非常简单。你试了什么?
RewriteRule ^/itineraries-prices/?$ http://www.annonline.com/itineraries-prices/index.html [R=301,L]