Redirect IP address to domain name on apache


Add the next lines right below :

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.)$ https://example.com$1 [R=permanent,L]

Add the next lines right below :

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.)$ https://example.com$1 [R=permanent,L]


Leave a Reply

Your email address will not be published. Required fields are marked *

9 − 1 =