I have a redirection rule that redirect my any domain.com request to www.domain.com, But if i try open my domain with ip it redirects to www.ip/.I want my site to open when i try to open with ip.for reference this is what my htaccess looks like.RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$https://www.%{HTTP_HOST}/$1 [R=301,L]
My ip is redirecting to www-ip
redirects;301 redirect
You could add another condition (RewriteCond directive) to prevent the redirect happening when an IP address has been requested:RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} !^\dRewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R=301,L]When the host does not start with www. and does not start with a numeric digit.Note that you'll need to clear your cache before testing, as the <ip> to www.<ip> redirect is likely to have been cached by the browser.Although it would perhaps be more usual to canonicalise the URL and redirect the IP address to the domain name?