【发布时间】:2009-09-04 02:37:21
【问题描述】:
基本上,我的客户希望让新访问者通过启动页面进入我正在开发的网站。不幸的是,谷歌索引了主页。所以没有人真正看到启动页面。有没有一种方法可以让 .htaccess 文件在查看者浏览器中创建一个 cookie,上面写着“我不是新手”(或者可能是 showsplash=false)。然后 .htaccess 可以检查 cookie 是否存在,如果不存在,则加载启动页面。这是我的代码:
Options +FollowSymLinks
RewriteEngine on
# Redirect to the splash page if new visitor
RewriteCond %{HTTP_COOKIE} !^.*show_splash=false.*$ [NC,R]
RewriteRule .* %{HTTP_HOST}
# If it's a new visitor, set the cookie
RewriteCond %{HTTP_COOKIE} !^.*show_splash=false.*$ [NC]
RewriteRule .* - [CO=show_splash:false:%{HTTP_HOST}]
我不相信这是正确的或有效的。有人知道应该怎么做吗?
【问题讨论】:
标签: .htaccess mod-rewrite cookies