Jump to content

Important. How do I detect https and then NOINDEX, NOFOLLOW?


Recommended Posts

Hello!. Respect to everyone.

 

I would be more than grateful if you could explain me the way to do the following:

 

I just want to know how to detect if https is enabled and if so write <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> at the head section.

 

I use <link rel="canonical" href="http://www.mydomain.com/" /> but I think this will bring extra safety. I think this is very useful for everyone because in this way we could assure there will no "https" duplicate content issues.

 

I've tried many ways but all of them return compile errors. Could someone help me please?

Link to comment
Share on other sites

Done!.

 

This is the code:

 

 

{if Tools::getCurrentUrlProtocolPrefix() == 'https://'}

<meta name="robots" content="noindex,nofollow" />

{/if}

 

works like a charm!. If you want to avoid "https" duplicate issues this is your code as well as:

 

<link rel="canonical" href="http://www.yourdomain.com{$smarty.server.REQUEST_URI}" />

 

with this is almost impossible to have duplicate content issues.

 

Thank you Oka! Gracias!

Edited by minesweeper (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...