Hi,
Before putting a .htaccess file, I could access my website with “https://” or “https://www” putting “http://” or “http://www” in the URL, but after, the .htaccess file does not redirect it to “https://” or “https://www”.
Thank you!
Hi,
Before putting a .htaccess file, I could access my website with “https://” or “https://www” putting “http://” or “http://www” in the URL, but after, the .htaccess file does not redirect it to “https://” or “https://www”.
Thank you!
Hello there,
Try this rule instead:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
It works! Thank you very much!
One more question, if I want to put a button and when I click on it, it redirects me to “https://www.(mydomain)/example”. Have I to change it on .htaccess?
If I understand you correctly, you want to create a button but when someone wants to manually click it, they will be redirected to "https://www.(yourdomain).com?
If so, then you do not need to add additional htaccess rule, you will only need to edit your code like this for example (An HTML code example):
<form action="https://www.(yourdomain).com">
<input type="submit" value="WWW with HTTPS" />
</form>
If you want to automatically redirect your visitors to https with the www prefix then you can use this htaccess rule instead:
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Just make sure to change yourdomain.com
to your own domain.
Ok. Thank you!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.