ricardo santos
Verified User
Hello
i can't redirect ip to domain name !
guides on the Internet was useless
How do I do this?
i can't redirect ip to domain name !
guides on the Internet was useless
How do I do this?
i tried these codes but not worked:Hello,
Kindly provide details on which exactly solutions your tried and what exactly did not work out? Nobody wants to play a guess game, suggesting solutions which you probably already tried.
yes, with real IP and domainAnd you replaced fake IPs and domain names with your real IPs and domains?
If yes, then I believe you added the file into a wrong location.
For server IP it should be /var/www/html/.htaccess
For shared IPs it should be /home/admin/domains/sharedip/public_html/.htaccess
- admin might need to be replaced by another reseller, which you use there.
And only for private/dedicated IPs it should be under /home/bob/domains/example.net/public_html/.htaccess
- bob - a fake username to be replaced by a real username.
- example.net - a fake domainname to be replaced by a real domain name.
p.s. I did not validate your mod_rewrite rules, and I assume they are fine. Anyway it's up to you to verify they work under a correct location.
And the problem was solvedRewriteEngine On
RewriteCond %{HTTP_HOST} ^111\.111\.111\.111$ [NC,OR]
RewriteCond %{HTTP_HOST} ^([a-z.]+)?domain\.com [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?MYDOMAIN\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.MYDOMAIN.com/$1 [L,R=301]