Google在我的网站上索引了某些页面,我不希望用户直接访问这些页面,而是从主页访问(例如(。
使用 .htaccess 如何将传入的外部链接重定向到某些页面并使其转到我的主页?
要防止 Google 将来将您网站上的特定网页编入索引,请使用 noindex 元标记。
将特定页面发送到主页,例如 http://mysite.com/somddir/somepage.htm
将以下内容添加到您网站根目录中的 .htaccess 中
RewriteEngine on
RewriteBase /
# add a rule like this for each page you want to redirect
RewriteRule ^somedir/somepage'.htm$ / [L,NC,R=302]
请务必使用 R=302
而不是 301
,这是永久性的。
我认为您必须在RewriteCond中使用HTTP_REFERRER:
RewriteCond %{HTTP_REFERER} http':'/'/example.com/
RewriteRule (.*)$ index.php
'RewriteEngine on重写库/
RewriteRule ^testpage.htm$/[L,NC,R=302] '