When on a https section of an EE page (e.g. https://domain.com/account) and having a link back to the homepage somewhere in the header, how do I set up the links so that https is not automatically added?

I am using Focus Labs Master Config and in my header snippet I have the url set up like so:

<a href="{path=''}">Homepage</a>

I have already tried different other combinations like {path='site_index'} but however I put it while on an https page the link turns out to be like


3 Answers 3


EE does not have any built-in link constructors that directly handle single sites spanning multiple domains / protocols / ports. So, to your question: EE doesn't understand that part of your site lives in HTTP, and part lives in HTTPS.

You may want to just use hand-entered URLs. For the home page, instead of using {path=''}, use literally: http://domain.com/.

And, for other pages, you may need to construct your URLs by building out with {url_title} or {page_uri}, e.g., http://domain.com/{url_title} or http://domain.com{page_uri}

If you need to conditionally check for HTTP vs HTTPS in order to construct the URL, the SSL Check add-on might help. Practically, if you need to do this kind-of conditional check in a bunch of places in a bunch of templates, you could move the conditional into a snippet. In pseudo-code:

if segment_1 != "account" and HTTPS
   return http://domain.com/
else if segment_1== "account" and HTTP
   return https://domain.com/
   return /

Finally, if you can't get EE to readily produce links with the right protocol, and you're willing to insert an extra redirect into requests that are to the incorrect protocol (HTTPS but should be HTTP, or vice versa), you can code this kind of redirect rule in your .htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  #For HTTPS that should be HTTP
  RewriteCond %{SERVER_PORT} 443
  RewriteCond %{REQUEST_URI} !^/account(.*)$ [NC]
  RewriteRule ^(.*)$ "http://%{HTTP_HOST}/$1" [R=301,L]

Adding an extra redirect isn't ideal, but if you have a rare case you need to "patch" this way, it's workable.


Try just using / instead of the {path=""} variable.

  • nope, still the same. I guess it must have something to do with config overrides and .htaccess. I will investigate further when I'll have more time and then report back here for others (in case somebody else runs into this problem).
    – Marc
    Aug 20, 2013 at 16:48

Eventually I ended up finding this blogpost by Jonathan Dean which exactly scratched my itch. I configured my htaccess file accordingly and haven't had any problems with it until today. So, I might have come back here late but at least it is tested thoroughly now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.