如何使用 htaccess 避免 php 中同一文件的多个路径?
How to avoid the multiple path to same file in php using htaccess?
我的 url 是
www.abc.com/cbn/either/index.php
我只想通过当前 url 访问它。当我改变路径时
index.php 个文件,即
www.abc.com/cbn/index.php
不过,我正在访问 index.php 文件,从 SEO 的角度来看,这是一种糟糕的方法,因为现在 google 将索引同一文件的两个 URL。所以请帮我解决这个问题。
在你的 htaccess 中 RewriteBase 之后添加这样的行
RewriteRule cbn/index.php /cbn/either/index.php [R,L]
www.abc.com/cbn/either/index.php
我只想通过当前 url 访问它。当我改变路径时 index.php 个文件,即
www.abc.com/cbn/index.php
不过,我正在访问 index.php 文件,从 SEO 的角度来看,这是一种糟糕的方法,因为现在 google 将索引同一文件的两个 URL。所以请帮我解决这个问题。
在你的 htaccess 中 RewriteBase 之后添加这样的行
RewriteRule cbn/index.php /cbn/either/index.php [R,L]