How do I redirect elgg to use https not http? When someone goes to http I would like to redirect to https instead.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- kanha@kanha
kanha - 0 likes
- Herb@HerbWalsh
Herb - 0 likes
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- mydomain.com redirect to https://www.mydomain.com
- www.mydomain.com redirect to https://www.mydomain.com
- http://mydomain.com redirect to https://www.mydomain.com
- http://www.mydomain.com redirect to https://www.mydomain.com
- https://mydomain.com redirect to https://www.mydomain.com
- https://www.mydomain.com does not change anything
- kanha@kanha
kanha - 0 likes
- jmperu@jmperu
jmperu - 0 likes
- adrew22a@drew22a
adrew22a - 0 likes
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- adrew22a@drew22a
adrew22a - 0 likes
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- kanha@kanha
kanha - 0 likes
You must log in to post replies.In your .htaccess you need to add
You can find more resources and good reading stuffs at
https://serverguy.com/servers/redirect-http-to-https/
https://stackoverflow.com/questions/4083221/how-to-redirect-all-http-requests-to-https
https://www.hostpapa.ca/knowledgebase/automatically-redirect-http-traffic-https/
https://help.dreamhost.com/hc/en-us/articles/115003505112-How-to-force-your-site-to-redirect-to-https-SSL-
https://in.godaddy.com/help/redirect-http-to-https-automatically-8828
I myself am struggling a bit with this because how the users type in your domain name and how the browser behaves varies a lot, for example: just "mydomain dot com" typed in Firefox automatically takes to the https site ( I have done a https install of Elgg 3x by web installer) BUT Chrome in mobile does not do this, it shows http www instead, and labels as insecure site ( default behavior, I have not done htaccess changes here)
Thus users can type in
mydomain com
www mydomain com
http mydomain com
http www mydomain com
https mydomain com
https www mydomain com
So we need to decide which is the thing that it will redirect to whatever may the user type.
If you find any useful tips please share.
If you are using nginx as a webserver you can use this server block. Just replace 127.0.0.1 with your own ip and yourdomain with whatever your domain name is. If you don't have m or www just leave them out. you can try with just server_name _; as second line if you wish as that should work as well:
server {
listen 172..0.0.1:80 default server;
server_name yourdomain.com www.yourdomain.com m.yourdomain.com;
return 301 https://$host$request_uri;
}
You can add the following to your htaccess file right after the line "# If you must add RewriteRules to change hostname, add them directly below (above all the others)"
what does the below piece of code do?
This is a tested code and I am using the same code in my server. You can also test it if you want at https://www.campuskarma.in
Thats great help. Many thanks @Rohit Gupta
on your server with cpanel just do a redirection from http: // mysite to https: // mysite
what if I don't want to go to https://www.mydomain.com? I want to go to https://mydomain.com
@adrew22a.. Just for the headsup.. we live in an era where we have something called as "Google" where you can almost find everything..
Just wanted to make sure the you knew about google before telling you the solution.
I hope this helps.. I only changed 3 things..
1st: Line 5 - I removed www
2nd: Line 8: I removed ! sign
3rd: Line 9: I removed www
I have not tested the code but i think this might work. And remember to use google.
And that kind of attitude is why open source projects die. People get afraid to ask questions or suggest input. Thanks for your help though.
All I am saying is that people like free buffet. All the solution just served to them on plates. A little curiosity is good. It help you learn new things (and sometimes also contribute to the open source projects, which will definitely keep the project alive). If you would have tried to understand what the piece of code does you could have easily found the solution on your own.
Anyways, It was not to offend you. I am sorry if it was in-appropriate in any way.
Imho Rohit Gupta has provided actual help with actual code. This is what helps a forum as well as open source run. While this will be out of topic : open source projects' deaths have got nothing to do ( or more or less nothing to do) with "attitudes" in general. During the past 10 years or so there has been no significant new open source project in php. No new open source web scripting language as successful as php too. Just think projects like Elgg, Wordpress, Drupal will never happen again. The world is now sheepishly slave to the trio Google-Apple-Facebook. Many entities now have only fb/ address in billboards and elsewhere and not www address. Apps are killing the open and interconnected net, and for Apps you have to be "slave" to Google or Apple ( and MS). Why Apps are something not like http html php websites - where you host your own either on free or paid servers or even your own server ?? No one complains, no lawsuits !!
Opensource generation is a dying generation thus. Despite several ongoing projects, its not that the flourishing majority when Tim Lee "invented" www and Rasmus Lerdorf "created" Php. Its sad. Many "opensource" projects got sold to biggies. And many opensource projects made their own commercial firms like Wordpress and Drupal. Opensource and money earning has no conflict with each other as such ( without money you cannot survive) but the spirit ... I dont know. There will be no more "whiz kids" like Matt (Wordpress), Dries (Drupal) or for that matter Ben Werdmuller who started Elgg but has shifted to other priorities now ( I think so). Many opensource projects actually died as the young ones who started these needed money for survival ( or needed to be "more rich") and commercialization of open source was not that much success for most of them. So they had to devote more and more time to jobs ( or in some cases their own companies or in the companies which "purchased" them). Elgg 2x has many and many more plugins( and thus more adoption) than Elgg 3x will ever have because of the same reason. The number of interested and talented youth who could have contributed are now in look out for actual jobs and money or are absorbed passively in the Apps world or rather than trying out php are chatting on Fb. The existing opensource projects do have some flaws which do not let them flourish, that is another issue.