Remove https from search engine search results with apache and mod_rewrite
|
|
| diversen |
| 05-Apr-2010 14:35:00 |
This server is installed with mod_ssl, which means that you can use both https and http. That was just fine, until I discovered that google was duplicating my search results. So that each page was listed first as http://www.os-cms.net and then the exact same page, just as https://www.os-cms.net
The solution was to make two robots text. First the ordinary robots.txt and then make a robots_ssl.txt with this content:
User-agent: *
disallow: /
You need to have mod_rewrite enabled to use the solution: You add the following somewhere in your server setup:
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^robots\.txt$ robots_ssl.txt [L]
Works just fine!