can HTACCESS force a domain to our new IP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

can HTACCESS force a domain to our new IP?

Post by simonmlewis »

We have a problem with ISP propagation. All our other sites we have copied to a new host, work, except one!

Is there a way in HTACCESS on the old server, to force it to look at the NEW IP of the new hosting? Via 301.

So we tell it to 301 the site to look at 88.88.88.88 for example? Or do we just have to wait for as long as it takes??

I know this won't fix the email issue, but be good if it can do the website.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Nothing you can do about DNS propagation. You could potentially redirect the user to a specific IP, but that's probably going to look pretty dodgy. Best to just wait it out.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by simonmlewis »

Its now over 48 hours. Just taking so long.
How would we redirect user to specific IP?
Thing is, it seems to be only really me that it's affecting. Or maybe others on my ISP.

I just wondered if there was a HTACCESS way of forcing it, rather than my using Hosts file to work on the site in the meantime.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Start by flushing your DNS cache. You can also check DNS propagation monitoring sites, like https://dnschecker.org or https://www.whatsmydns.net or https://cachecheck.opendns.com/
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by simonmlewis »

And if they all show the new IP, but my Mac and PC still ping to the old one?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Then it sounds like a DNS cache issue to me. Might be your ISP, but you could always try from your mobile while not on wifi. Should be different DNS resolution.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by simonmlewis »

On my mobile, it's fine. It's only on Wifi through my ISP.
I tried them yesterday but they chucked excuses at me, to the point of "It could be your CSS".... WHAT??????????
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Code: Select all

sudo killall -HUP mDNSResponder
Should do the trick on macOS. Don't know about Windows.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by simonmlewis »

I did that and it came back with "no matching processes were found".
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Interesting.

Code: Select all

7:51 ~
❯ ps aux | grep -i dns
root              194   0.0  0.0  2497648    740   ??  Ss    1Feb17   0:32.68 /usr/sbin/mDNSResponderHelper
_mdnsresponder    180   0.0  0.0  2507560   3596   ??  Ss    1Feb17   1:10.68 /usr/sbin/mDNSResponder
Which version of macOS / OS X are you using? It has changed some over time.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by simonmlewis »

Sierra.
Do I do it via Terminal? So it starts with my name in the $name, and go from there or not?
I may be doing it wrong.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

Yes, through the terminal. Enter

Code: Select all

sudo killall -HUP mDNSResponder
and it should flush the cache.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: can HTACCESS force a domain to our new IP?

Post by Celauran »

simonmlewis wrote:So it starts with my name in the $name
Unclear what you mean by this. That could just be your prompt.
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: can HTACCESS force a domain to our new IP?

Post by Vegan »

add 8.8.8.8 to your DNS servers list
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply