Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-18 12:11:00

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

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

#2 2013-02-18 13:00:13

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

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

#3 2013-02-18 22:56:34

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Having both HTTP & HTTPS access to the site

This should work already:

https

http

You should be able to access all your site with the shared SSL….

Just make sure you are not calling assets from the page from non secure http links as this can sometimes throw errors

Offline

#4 2013-02-18 23:46:51

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

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

#5 2013-02-19 11:04:56

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

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

#6 2013-02-19 22:06:35

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

#7 2013-02-19 22:30:21

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

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

Board footer

Powered by FluxBB