-1

I am using .htaccess file to redirect my webpage URL to https://. But this code redirects only www.domain-name. If we type just https://domain-name.in or domain-name it is not redirecting. Please help me to solve this issue and redirect all URL to https://

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domainname\.in$
RewriteRule ^$ https://domainname.in/%{QUERY_STRING}
Dave
  • 5,108
  • 16
  • 30
  • 40
Piruthivi
  • 19
  • 3
  • Please do use proper tagging: this question is in no way related to PHP or HTML5 – Nico Haase Apr 17 '19 at 12:26
  • 1
    Possible duplicate of [Redirect NON-www to www for https](https://stackoverflow.com/questions/37241057/redirect-non-www-to-www-for-https) – Nico Haase Apr 17 '19 at 12:26

1 Answers1

0

You can do it like this:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Seth B
  • 1,014
  • 7
  • 21