473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Map to different index page when user enters ip in apache2

107 100+
Hello Experts, I have setup two virtual host pointing to same content mapped to ip 192.168.1.100. Everything works fine. But now my requirement is that when user enters the ip address instead of the domain name, the server should serve a different page instead of the index page of the domain. For now if i enter the domain name http://test.com and when i enter http://192.168.1.100, I am served with the index.html page of virtual host. Now, what i want is that when the user enter http://192.168.1.100, the server should serve default.html.

http://test.com ---> index.php
http://192.168.1.100 ---> default.html

The above is the summary as to what i want. Please advice me how to go about.

By the way I am using Ubuntu 14.04 LTS and Apache 2.4.7 for your kind information

** Sorry for posting in the wrong place. I would like to request the admin to kindly post it in the apache forum.
Dec 29 '14 #1
5 21781
Luuk
1,047 Expert 1GB
you can do something with Rewrite see: http://httpd.apache.org/docs/current...d_rewrite.html
Dec 29 '14 #2
raamay
107 100+
any other alternatives?
Dec 29 '14 #3
Luuk
1,047 Expert 1GB
Yes, you can check for referrer in you index.php, and forward the request to default.html

If $_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME'] are the same, you are getting there via ip-address.

To forward the request, use info from this page.
Dec 29 '14 #4
raamay
107 100+
will it be fine if i created another virtual host to take care of the request from the ip address?
Dec 30 '14 #5
Luuk
1,047 Expert 1GB
That is also possible

The first server that has this line:
Expand|Select|Wrap|Line Numbers
  1. <VirtualHost *:80>
will serve the requests that are not served by a later defined ServerName
(see: http://httpd.apache.org/docs/2.2/vhosts/examples.html)
Dec 31 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Adriaan van Heerden | last post by:
hi, I'm very new to Access and have been searching newsgroups for a few days but can't find exactly what I need. I want to be able to do the following: * user enters patient's hospital number *...
1
by: tcb | last post by:
I have a RangeValidator setup for two input fields. The validator Type is set to Integer. If the user enters an alpha numeric, the validator works, however, if the user enters a space, the validator...
1
by: peter174 | last post by:
How does one go about doing that? I am using C# .NET
2
by: eddy556 | last post by:
Hey, Im having trouble making a textbox change colour when a user enters it. I have managed to textBox2.BackColor = Color.Pink; place that in the code which seems to work but I wish for it to...
1
by: airwinx | last post by:
Hi all, i am new to javascript and would like to learn more. I face some problem in select box option. I am a php and mysql programmer but come javascript I am idiot. I need some solution: I am...
8
by: wish | last post by:
Dear all, I would to ask that why the user always faced the different page when user click the back button instead back to page2.php but it go to page5.php..I remember in asp, we use the...
3
by: pveena | last post by:
Hi, I am new to php. I have two pages.one is login page other is details page. When user enter detaisl page directly in URL i want to redirect to login page then login success it should go to...
2
by: maheshprof | last post by:
hi , how to enable a button when i enter a text in a textbox.and also it should be disabled initially after user types a text in the textbox it should enable
3
by: gussi | last post by:
when i used <?php @header("Location:google.co.in"); ?> .. the page is not redirecting to that page,, if i remove @ sign then it is showing worning session already started(...)in...
2
by: ALIYU HABIB | last post by:
I want to write a code on username and password authentication, but i can't display "*" when entering the password. I am using turbo c++ compiler.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.