Comments (6)
I think so. I'll have to look to be sure, but I think there's a $_SERVER['SERVER_PROTOCOL'] that should probably be used in stead of 'http://'.
The PHP documentation is a little vague on what 'SERVER_PROTOCOL' does. From PHP.net
'SERVER_PROTOCOL'
Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
If not, I'm sure there are other ways we can make this work.
from wet-boew-php.
Turns out it's quite a bit of effort to setup SSL for Apache on either Linux or Windows. @crochefort Could you make the change on your local copy and test this possible fix out?
I found a PHP variable that indicates if HTTPS is on or off.
I'd like to see Line 9 replaced with:
$protocal = "http://";
if( $_SERVER["HTTPS"] == 'on' ) {
$protocal = "https://";
}
$q = $protocal . $SERVER['HTTPHOST'] . $SERVER['QUERYSTRING'];
When it's working we'll put it up in the repository.
from wet-boew-php.
I believe there are several flaws with the following line than just missing support for both http and https:
$q = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['QUERY_STRING'];
HTTP_HOST resolves to the domain of the server.
QUERY_STRING resolves to the parameters after the ? in the URL
ISSUE 1: There is no question mark between the domain and the parameters. So, if the host is canada.ca and my query string is lang=en, it will build the following URL:
http://canada.calang=en
ISSUE 2: The path and the page are missing from the URL. For example, if I am currently on the http://canada.ca/contact?lang=en page, the above code will turn this into http://canada.calang=en which is not going to help you switch language.
ISSUE 3: There is no support for port numbers. For example, if the page we are accessing is http://canada.ca:8081/contact?lang=en, the above code will once again turn this into:
http://canada.calang=en
ISSUE 4: As mentioned by crochefort, there is no support for HTTPS.
ISSUE 5: There is no support for fragments. For example, if the page we are accessing is http://canada.ca#footer, the above code will convert this to http://canada.ca. Unfortunately this last one can only be resolved using client-side JavaScript as the hash and fragment are not sent to the server.
As for the rest, if you don't mind my making a suggestion, consider replacing the above code with something like this:
$protocol = 'http';
$port = '';
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
$protocol .= 's';
} elseif ($_SERVER['SERVER_PORT'] != 80) {
$port = ':'.$_SERVER['SERVER_PORT'];
}
$q = $protocol . '://' . $_SERVER['HTTP_HOST'] . $port . $_SERVER['REQUEST_URI'];
Hope that helps.
Best regards,
Michael
from wet-boew-php.
I just try the one from @michael-milette and Chrome give me the error .. too many redirect.
The one from @upsonp is working great on my Dev.
On my Dev I have a non-valid SSL certificat and it's working fine.
from wet-boew-php.
Thanks to both of you for trying this out.
I guess I'm just going to have to break down and figure out how to install SSL for my dev servers so I can do some testing. Maybe sometime really early next year ;)
from wet-boew-php.
Closing since no longer revelant with the new script
from wet-boew-php.
Related Issues (20)
- remove links on footer menu headers HOT 1
- Maintenance Mode... HOT 2
- PHP Menu Generator HOT 18
- Links in header need to be updated HOT 9
- V4 missing error page coding. HOT 10
- V4 Archived page don't show ARCHIVED - in the title HOT 2
- V4 Archived text need to be updated
- Cloning just the DIST-PHP folder instead of the whole project HOT 8
- GOC Template user how do you... HOT 2
- V4 New issue found while validating with WPSS HOT 2
- WET4 changes that need to be take care! HOT 5
- wet-boew-php as bower dependency HOT 9
- wet-boew-php 4.0 HOT 11
- The Secondary Utility Menu Page - side menu doesn't work. HOT 3
- Base theme footer background is the wrong colour HOT 6
- Title is just a slash on language selection splash page of on demos-php HOT 7
- FIP images missing on 404 server pages in demos-php site HOT 6
- WET 4 - Missing support for session login/logout (sign in/sign out) HOT 3
- Please tag v4.0 branch HOT 2
- GCWeb Canada.ca Redesign theme HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wet-boew-php.