Mani
Mani

Reputation: 309

Redirect all urls to non www https

I have a dedicated server (Apache+Nginx (as proxy reverse) and php-fpm , mod-rewrite is activated), I host many domains and in one specific domain I want all requests to https://domain.com. I have tried many solutions and all theme but none worked for me.

Please give me a complete code to put in .htaccess to redirect The following:

domain.com
www.domain.com
https://www.domain.com  

To:

https://domain.com

Upvotes: 1

Views: 123

Answers (1)

Dofri
Dofri

Reputation: 126

you need write this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

Upvotes: 1

Related Questions