Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My IP xxx.xxx.xxx.xx is pointing to example.com at GoDaddy but I just noticed that when I type the IP in browser, it doesn't redirect to the website, how can do this? I am sure this will happen through httpd.conf but unsure about what I need to add.

share|improve this question

You can use the .htaccess file to redirect from IP to domain using this code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^555\.555\.555\.555
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Change 555.555.555.555 to match the IP of your server, additionally though you can use canonical urls that will prevent duplicates entering Googles index, Check out: Should I redirect the site IP address to the domain name.

share|improve this answer
Hi @bybe, actually I am using ruby on rails so there is no .htaccess file and I only make changes in .httpd.conf file, can you tell me that code for that ? – iCyborg May 23 '13 at 10:01
You should be able to create a .htaccess file yourself, I'm not to familiar with Ruby on Rails but I'm assuming this is just running on Apache. – Simon Hayter May 23 '13 at 10:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.