0

I tried the following .htaccess code to redirect the IP address of my VPS server to my domain, but despite of all efforts it keeps resulting in a 404 error:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^xxx.xxx.xxx.xxx
RewriteRule (.*) http://yourdomain.com/$1 [R=301,L]

I have other redirects in my .htaccess which are working normally.

Can someone help me to solve this problem?

Update:

It seems it's solved now, but it is working only when I put HTTPS before the IP. It does not work with the default HTTP.

Any clues?

marked as duplicate by dan Feb 12 at 7:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.