[英]htaccess redirect incoming links to certain pages to homepage
谷歌已将我网站上的某些页面编入索引,我不希望用户直接访问这些页面,但是从主页(例如)。
使用.htaccess如何将传入的外部链接重定向到某些页面并将其转到我的主页?
我认为你必须在RewriteCond中使用HTTP_REFERRER:
RewriteCond %{HTTP_REFERER} http\:\/\/example.com/
RewriteRule (.*)$ index.php
为防止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
,这是永久性的。
`RewriteBase上的RewriteEngine /
RewriteRule ^ testpage.htm $ / [L,NC,R = 302]`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.