472,807 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 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 21391
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.
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.