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 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, I am served with the index.html page of virtual host. Now, what i want is that when the user enter, the server should serve default.html.

http://test.com ---> index.php ---> 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
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
107 New Member
any other alternatives?
Dec 29 '14 #3
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
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
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

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...
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
by: peter174 | last post by:
How does one go about doing that? I am using C# .NET
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;
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...
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?
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.
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
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...
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.
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...
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,...
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...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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.