473,395 Members | 2,446 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,395 software developers and data experts.

Redirect Based on What They Typed In

Imagine your web hosting provider just permitted you to type
*.mydomain.com and you still get to the mydomain.com website that they
host for you. Imagine you want to setup websites for your family like
dad.mydomain.com, mom.mydomain.com, etc.

Well, this is a request and some information for you. First, here's
how you could use PHP to react to what they type in the URL:

<!-- save as index.php in /var/www/html on Linux Apache: -->
<?php
$headers = getallheaders();
if (in_array('dad.mydomain.com', $headers)) {
header('Location: http://www.mydomain.com/dad/');
exit;
}
if (in_array('mom.mydomain.com', $headers)) {
header('Location: http://www.mydomain.com/mom/');
exit;
}
?>

So imagine your workstation is where you're developing and testing
this. What changes would you make to /etc/hosts, Apache, or something
else on your Linux system so that it accepts *.mydomain.com?

So, the request -- the reason I ask is I want to inform my web hosting
provider of the changes they can make to their Linux system so that I
can start using this PHP index.php script to redirect to various
websites under mydomain.com.

For now, in experiment mode, I had to add dad.mydomain.com and
mom.mydomain.com to /etc/hosts for 127.0.0.1 to get this to work. But
I wish I could do something dynamically.

Thanks!
Jul 17 '05 #1
0 1522

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Hans | last post by:
Hi there, I have a number of domain names and they all point to the same IP address. I would like to redirect to a specific folder, based on the domain name used to access the site. For example....
6
by: Keith Patrick | last post by:
I have to do some programmatic redirects (in several pages) based on URLs I am given from an external source. The URLs have querystrings at the end, but one in particular is about 240 chars long,...
3
by: ABC | last post by:
If I has a web site which contains follows maps: \default.aspx \search.aspx \products.aspx \contacts.aspx I should want to handle the unknow URL redirect to search.aspx to search. For...
10
by: Savanah | last post by:
Hello, I would like to call another page using POST method, something like this : Response.Redirect("http://www.mydomain.com/cgi-bin/log.dll?email="+tbLoginID"). I set this in my page <form...
12
by: =?Utf-8?B?cGI=?= | last post by:
I am having trouble doing a redirect in an async asp.net implemention. Most of the time it works, but when it doesn't it just "hangs", the browser never gets any return page. If I run it under the...
7
by: Jlo | last post by:
Hi, I have a c# winforms application. When I call the report file, it shows me all the records in the table. How can I make it to call only a particular range. i have the following code...
7
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am trying to set this up using asp code and IIS configuration. But it seems not working. Here it is the way I am doing. In IIS I set up a virtual directory with secure communication, I...
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
1
by: THG | last post by:
So here is my story. I have one host, and many websites. So I need a redirect based on the request. Currently if someone types in some of my websites, such as comptutes.com or xboxachieve.com,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
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,...

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.