MyBB Community Forums

Full Version: Ip address instead of domain name
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Ok, i added it like this:

RewriteCond %{HTTP_HOST} ^www.xyyzz.com [NC]
RewriteRule ^(.*)$ https://xyyzz.com/$1 [L,R=301,NC]
RewriteCond %{HTTP_HOST} ^111\.111\.11\.11[NC]
RewriteRule ^(.*)$ https://xyyzz.com/$1 [L,R=301,NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Let us see if something changes in the next few days.

So, i'm posting the right code. The proper spaces must be respected, otherwise the code won't work as it should.

RewriteCond %{HTTP_HOST} ^www.yourwebsite.com [NC]
RewriteRule ^(.*)$ https://yourwebsite.com/$1 [L,R=301,NC]
RewriteCond %{HTTP_HOST} ^111\.111\.11\.11 [NC]
RewriteRule ^(.*)$ https://yourwebsite.com/$1 [L,R=301,NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


Yourwebsite = The URL of your website

111\.111\.11\.11 = The IP of your website.

So, now when i visit the IP showed from google, i am redirected to my website's URL.

I will be checking if the IP address vanishes from Google search also in the next days.

Regards.
Pages: 1 2