0

I want redirct https without www,

i have tried below code,

RewriteCond %{HTTP_HOST} ^www\.subdomain.doamin\.io [NC]
RewriteRule ^(.*)$ https://ubdomain.doamin.io/$1 [L,R=301]
Ankit Mishra
  • 130
  • 11
  • 1
    Try the code again with fewer typos? (e.g not redirecting **subdomain**.doamin to **ubdomain**.doamin) Or update the question if it's just incorrect here. – CD001 Mar 19 '18 at 10:52
  • Your question does not make clear whether you want an alternative to using a .htaccess file, or whether yours doesn't work. If the latter is the case always describe what it does wrong. – KIKO Software Mar 19 '18 at 10:57

1 Answers1

0

Try the below code,it will redirect to https without www and works for me

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
RewriteRule (.*) https://%1%{REQUEST_URI} [L,R=301]
user3040610
  • 750
  • 4
  • 15