Ssl – Lighttpd mod_rewrite and SSL

httpslighttpdmod-rewritessl

I'm trying to prevent the search engines from crawling through SSL version of the site, to prevent content duplication and canonization issues.

I found the following great article:
http://www.seoworkers.com/seo-articles-tutorials/robots-and-https.html

Problem is, that I'm using lighttpd, which doesn't seem to have the RewriteCond directive, to limit the rewriting only to SSL.

Can anyone advice if this possible on lighttpd, and give a snippet?

Thanks in advance!

Best Answer

try this:

$SERVER["socket"] == "a.b.c.d:443" {
  ...

  $HTTP["host"] =~ "<yourhostname>" {
    url.rewrite-once = ("^robots.txt$" => "robots_ssl.txt")
  }
}

the url.rewrite-once should definitely be in your $SERVER["socket"] section of your ssl part to be only applied when your ssl host is accessed.

url.rewirte-once can be placed without conditional but it seems that it will not work all the time according to some forums.

Related Topic