- Joined
- Sep 2, 2018
- Messages
- 15
Hi! i know you can do it within .htaccess but what would be the right url that would automatically redirect http to https urls ?
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
If you have Plesk or cPanel then you should be able to do this from the panels easier to maintain.
The question, as posed, doesn't make sense. It wouldn't be a URL but a rewrite rule that would do the redirect. As for Rewrite Rule there are many options and many examples if you Google the question "How to automatically redirect to https with htaccess"
Some very basic code to do it would be:
Code:RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
But there are all types of examples this was just the first one from: https://serverguy.com/servers/redirect-http-to-https/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://sitename.com%{REQUEST_URI} [R=301,L]
The code I use is as follows and also rewrites the deprecated www. out of the url too:
The code I use is as follows and also rewrites the deprecated www. out of the url too:
Code:RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(www\.)?(.+) RewriteRule ^ https://sitename.com%{REQUEST_URI} [R=301,L]
HTH,
J.
Is the code in the .htaccess file of the root (top level) directory like www or public_html? If so you may need to ask your host the best way to redirect traffic.
Its not deprecated, some just choose not to use it, either way is perfectly fine.The code I use is as follows and also rewrites the deprecated www. out of the url too:
Well... The issue I had with one forum was that people were logging into the site via www.site.com as opposed to simply site.com and this caused a bit of an issue with users being logged out of the forum. Even though the settings were set to site.com - It seems that their browsers recognized www.site.com and site.com as two different properties. We implemented the above .htaccess code and the issue was instantly resolved because the code routes all users to https://site.com and disallows the www ... which I suppose in my opinion is deprecated as all sites begin with it, unless you're accessing ftp, DNS or some other service/application.Whether one uses the www or not is a separate matter, if they choose not to use it they need to make sure their forum URL in setting matches their choice.
As for it being "depreciated" someone should tell Google: https://www.google.com/
Glad the code worked for you!This rule works great !! for the forum, i am having issues with my custom made homepage though, so i will look into it more later.
LOL. Well... There are plenty of arguments on both sides as stated above.Its not deprecated, some just choose not to use it, either way is perfectly fine.
And oops Miyukichii - I did mean to also say welcome to TAZ.i am having issues with my custom made homepage though
Yup. The XF install had an issue with different cookies being served. The only way I found of solving the issue was to implement the .htaccess code. There are probably other ways to maybe *better* fix the issue - but the .htaccess code worked and no further issues after that.Actually what happened (if using XenForo) is it was using 2 different cookies - each domain has it's own and would cause you to be logged out if switching between the two.
For sites like WordPress, etc. (blogs and stuff) it really doesn't matter if it's not writing a cooking for login credentials.
Well... The issue I had with one forum was that people were logging into the site via www.site.com as opposed to simply site.com and this caused a bit of an issue with users being logged out of the forum. Even though the settings were set to site.com - It seems that their browsers recognized www.site.com and site.com as two different properties.
And oops Miyukichii - I did mean to also say welcome to TAZ.
About the issue with your homepage though: what sort of issue are you having? Perhaps someone here can offer a fix for it...
J.