Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Having both HTTP & HTTPS access to the site
Hi!
I will like to know please how do I enable both secure and non-secure URLs to the same site please?
I have a shared SSL in my hosting account, so I will like to be able to access the site using the ugly shared SSL url, and with the regular non-secure domain url please.
Offline
Re: Having both HTTP & HTTPS access to the site
If it makes it more simple to do, then this can be also only for a specific section, since basically I need it for Facebook iframe tabs.
So both links will work:
(Hostgator shared SSL example)
https://secure1234.hostgator.com/~username/index.php?s=facebook
http://example.com/facebook
Offline
Offline
Re: Having both HTTP & HTTPS access to the site
With a regular SSL certificate you should be able to access your site from both https and http. Its worth ensuring that you are covered for both domain.com and www.domain.com – the www being technically a sub-domain.
Offline
Re: Having both HTTP & HTTPS access to the site
OK I found the problem,
for example if I enter this url:
https://secure1234.hostgator.com/~username/index.php
It’s not considered as a “messy url” while my “Permanent link mode” is set to “/section/id/title” and I get redirected to the error page instead of the homepage.
If I’m changing to “?=messy” then it works.
But If I’m using a specific section as:
https://secure1234.hostgator.com/~username/index.php?s=default
or
https://secure1234.hostgator.com/~username/index.php?s=facebook
Then it works fine without changing to “?=messy”.
But it changing all the links inside to https://example.com
instead of the shared SSL url.
This probably because of the “Site URL” in the preferences.
I’m using the <txp:site_url />
tag for the links of JS files and images.
So if I’m not wrong I got 4 options:
1. Use relative urls without the <txp:site_url />
tag.
2. Use a variable to store the site url base on section instead of the <txp:site_url />
tag (as in this case I need it only for a specific one).
3. Wrap it all in a <txp:rah_replace...
tag base on section.
4. Use a magical PHP code that will make the <txp:site_url />
tag to work with the shared SSL url somehow o_O
Am I right?
Offline
Re: Having both HTTP & HTTPS access to the site
I think 1,2 & 3 would all probably work… not sure about 4 – this could be plugin territory.
I once looked at something similar for forcing the www with <txp:siteurl /> but got a head ache at the amount of times it was entered…. It is probably only controlled by 3 lines of code or something, but I don’t have the skills to find them yet :)
Offline
Re: Having both HTTP & HTTPS access to the site
Yep, so I ended using option #2, store the domain in a variable base on section:
<txp:variable name="siteurl"><txp:if_section name="facebook">https://secure1234.hostgator.com/~username/<txp:else /><txp:site_url /></txp:if_section></txp:variable>
<script src="<txp:variable name="siteurl" />scripts/jquery.js"></script>
<script src="<txp:variable name="siteurl" />scripts/default.js"></script>
And instead of using the <txp:image_url />
tag inside of <txp:images />
:
<txp:variable name="siteurl" />images/<txp:image_info type="id" /><txp:image_info type="ext" />
and for thumbnails:
<txp:variable name="siteurl" />images/<txp:image_info type="id" />t<txp:image_info type="ext" />
Offline