473,854 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Map to different index page when user enters ip in apache2

107 New Member
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 21899
Luuk
1,047 Recognized Expert Top Contributor
you can do something with Rewrite see: http://httpd.apache.org/docs/current...d_rewrite.html
Dec 29 '14 #2
raamay
107 New Member
any other alternatives?
Dec 29 '14 #3
Luuk
1,047 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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
1405
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 * after pressing enter, a function fires that looks up the patient name & surname corresponding to the hospital number just entered (in the "patients" table) * if the hospital number exists in the patients table then name & surname are filled in in...
1
2284
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 does not work. Does anyone know why this validator doesn't work for a space (or how to fix it Thanks tcb
1
1405
by: peter174 | last post by:
How does one go about doing that? I am using C# .NET
2
2295
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 only happen when a user enters it. This is what I have: private void textBox1_Enter(object sender, System.EventArgs e) { textBox2.BackColor = Color.Pink;
1
3092
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 designing an inventory system for one of my project, I have 2 select box in one page. User will have to select the item in the 1st select box to categorize out their option and display in second select box. Or else second select box will not show...
8
2482
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 global.asa to solve this problem because the server will confuse when many user login the system as a member and every members go different pages. So may i have anyone to guide me?
3
2966
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 detaisl page. Could any one help me out. I tried using a variable declaring , assigning in login page. checking the value in details page. but i am getting error as variable not defined if open directly details page.
2
3243
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
1767
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
36606
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
10684
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10763
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10371
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9517
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5744
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4563
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.