IP Address in the URL - is that bad?

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:

IP Address in the URL - is that bad?

Post by simonmlewis »

We have been told that our site is allowed to have the IP address used in the URL , in place of the domain name, and that this is bad.

ie.
www.sitedomain.com/contact-us
Is the same as:
88.88.88.88/contact-us.

Is this a bad thing?
If it is, how does one resolve it?
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: IP Address in the URL - is that bad?

Post by Celauran »

Should be fairly trivial to redirect all such requests.

Code: Select all

RewriteCond %{HTTP_HOST} ^88\.88\.88\.88$
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
Post Reply