473,320 Members | 1,858 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,320 software developers and data experts.

How to redirect based on url typed?

I have two domains. mikewebs.net and mikewebs.com. They both point to the same ip.

I want to redirect people to the correct page based on the url typed.

My code is this:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $fulluri = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  3. echo $fulluri;
  4.  
  5. if ($fulluri = "https://mikewebs.com")
  6. {
  7.     header('Location: IP.PHP');
  8.     exit();
  9. }
  10.  
  11. if ($fulluri = "https://mikewebs.net")
  12. {
  13.     header('Location: MW.PHP');
  14.     exit();
  15. }
  16. ?>
  17.  
Both domains go to the IP.php page anyway. Please help??
May 31 '14 #1
2 1880
Luuk
1,047 Expert 1GB
I would create a virtual host in Apache

see: http://httpd.apache.org/docs/current.../examples.html

(in fact, i did do that ;)
May 31 '14 #2
Dormilich
8,658 Expert Mod 8TB
Both domains go to the IP.php page anyway.
the result of a non-falsy assignment is always truthy, hence the first if() will always trigger.
Jun 1 '14 #3

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

Similar topics

0
by: Google Mike | last post by:
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...
9
by: deko | last post by:
I have a page that I don't want anyone to be able to link directly to. The page should only be accessed from gatepage.php. I tried this code, but keep getting errors - "header info already sent",...
1
by: AJ | last post by:
Does anyone know how i can go about doing this? Thanks,
1
by: ldixon789 | last post by:
I'm trying to either redirect users to a new page or giving them an alert message depending on the value of a cookie. I'm very new to Javascript and would appreciate any advice on making the...
1
by: Andrew | last post by:
I am looking for a simple JavaScript program that would redirect users to one of two web pages based on the web page counter. For example, when the counter is odd, the user would be redirected to...
1
by: jonathanthio | last post by:
Do anyone knows how to redirect based on IP? Things like if (user.ip=202.23.23.4){ window.location="go here" }
3
by: neil_pat | last post by:
I have a stored procedure which returns a value of between 0 and 4. I want the user to press a button to receive feed back on their last input. The save button takes the input and saves it to...
1
by: Trev | last post by:
Hi everyone, I'm trying to modify an existing piece of Javascript that will enable a redirect to a page based on IP address and/or keywords in the referrer; for instance, redirecting an existing...
2
by: lm247 | last post by:
Hi, I have the following script which processes the html form and inserts into 3 tables. How can I pass the value of the variable EDSID to the next page using response.redirect? Been trying to...
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: 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...
1
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.