Rewrite Url From Ip To Domain

I had a website running at IP (lets say)

My .htaccess is

RewriteEngine on

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php

RewriteRule . index.php

I recently purchased a domain (lets say) and configured it. Website loaded with both IP and domain successfully.

Now, I want to rewrite in a way that all accesses via "IP" are redirected to domain, i.e. to be redirected as

And of course, all other links.

Any help?

try this:

RewriteEngine on

RewriteCond %{REMOTE_HOST} !^11\.11\.11\.11

RewriteCond %{REQUEST_URI} !/contact/sample$

RewriteRule ^(.*)$

/contact/sample was just an example, :)

its not possible to add all the links in htaccess for me.