Saturday, March 18, 2017

How to redirect IP to https://domain in .htaccess

My websites open with IP, But i need redirect IP to domain.

I create project with Laravel framework.

My server is Ubuntu 16.04

My .htaccess is: // This file is root folder

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  RewriteCond     %{SERVER_PORT} ^80$
  RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L]

  RewriteCond %{HTTPS_HOST} ^10\.10\.10\.10
  RewriteRule (.*) https://website.com/$1 [R=301,L]
</IfModule>

But this code not work with me.

Thank you



via mySun

Advertisement