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

Getting the actual URL in browser when

I'm trying to mask a URL and found a great way to point one domain to
another while keeping the original domain name in the browser address
bar:

<VirtualHost *:80>
DocumentRoot /var/www/html/demodomain
ServerName demodomain.com
ServerAlias www.demodomain.com
RewriteEngine on
RewriteRule /(.*) http://www.actualdomain.com/$1 [P]
</VirtualHost>

But I need to be able to determine if the bowser address is
"actualdomain.com" or "demodomain.com".
I've tried to get it with these:

$host = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['PHP_SELF'];
$servername = $_SERVER['SERVER_NAME'];
$httphost = $_SERVER['HTTP_HOST'];
$httpref = $_SERVER['HTTP_REFERER'];
$remotehost = $_SERVER['REMOTE_HOST'];
$requri = $_SERVER['REQUEST_URI'];

But $_SERVER['HTTP_REFERER'] is the only one that will show one or the
other correctly, however, ONLY after the person clicks on an href on
the page. The initial page they go to that variable will be unset.

Is there any way to determine which domain name is in the browser
address bar from the start?
Thanks!!
Liam

May 15 '06 #1
4 2047
ne**@celticbear.com wrote:
I'm trying to mask a URL and found a great way to point one domain to
another while keeping the original domain name in the browser address
bar:

<VirtualHost *:80>
DocumentRoot /var/www/html/demodomain
ServerName demodomain.com
ServerAlias www.demodomain.com
RewriteEngine on
RewriteRule /(.*) http://www.actualdomain.com/$1 [P]
</VirtualHost>

But I need to be able to determine if the bowser address is
"actualdomain.com" or "demodomain.com".
I've tried to get it with these:

$host = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['PHP_SELF'];
$servername = $_SERVER['SERVER_NAME'];
$httphost = $_SERVER['HTTP_HOST'];
$httpref = $_SERVER['HTTP_REFERER'];
$remotehost = $_SERVER['REMOTE_HOST'];
$requri = $_SERVER['REQUEST_URI'];

But $_SERVER['HTTP_REFERER'] is the only one that will show one or the
other correctly, however, ONLY after the person clicks on an href on
the page. The initial page they go to that variable will be unset.

Is there any way to determine which domain name is in the browser
address bar from the start?
Thanks!!
Liam


Why go to all that trouble? Just create an alias entry for the other domain.
No rewriting necessary.

Or, if you want different options, create another virtual host for the other
domain and point it at the same directory.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #2
Rik
Jerry Stuckle wrote:
Or, if you want different options, create another virtual host for
the other domain and point it at the same directory.


Which would give you a great oppertunity to use $_SERVER['SERVER_NAME']
http://nl2.php.net/manual/en/reserved.variables.php
'SERVER_NAME'

The name of the server host under which the current script is executing. If
the script is running on a virtual host, this will be the value defined for
that virtual host.

Grtz,
--
Rik Wasmus
May 16 '06 #3

Jerry Stuckle wrote:
ne**@celticbear.com wrote:
I'm trying to mask a URL and found a great way to point one domain to
another while keeping the original domain name in the browser address
bar:

<VirtualHost *:80>
DocumentRoot /var/www/html/demodomain
ServerName demodomain.com
ServerAlias www.demodomain.com
RewriteEngine on
RewriteRule /(.*) http://www.actualdomain.com/$1 [P]
</VirtualHost>

But I need to be able to determine if the bowser address is
"actualdomain.com" or "demodomain.com".
I've tried to get it with these:

$host = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['PHP_SELF'];
$servername = $_SERVER['SERVER_NAME'];
$httphost = $_SERVER['HTTP_HOST'];
$httpref = $_SERVER['HTTP_REFERER'];
$remotehost = $_SERVER['REMOTE_HOST'];
$requri = $_SERVER['REQUEST_URI'];

But $_SERVER['HTTP_REFERER'] is the only one that will show one or the
other correctly, however, ONLY after the person clicks on an href on
the page. The initial page they go to that variable will be unset.

Is there any way to determine which domain name is in the browser
address bar from the start?
Thanks!!
Liam

Why go to all that trouble? Just create an alias entry for the other domain.
No rewriting necessary.

Oh, my gawd. *thumps self in head* I can't believe I didn't think of
that.
Man! I suck!
Thanks for the clue-by-four. =/
-Liam
Or, if you want different options, create another virtual host for the other
domain and point it at the same directory.


May 16 '06 #4
ne**@celticbear.com wrote:
Jerry Stuckle wrote:

Why go to all that trouble? Just create an alias entry for the other domain.
No rewriting necessary.


Oh, my gawd. *thumps self in head* I can't believe I didn't think of
that.
Man! I suck!
Thanks for the clue-by-four. =/
-Liam

Or, if you want different options, create another virtual host for the other
domain and point it at the same directory.



Sometimes the obvious is *too* obvious? :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #5

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

Similar topics

7
by: KK | last post by:
Please help! I am currently experiencing a bug in Safari v125.9. When I modify the value of form input box and then get the innerHTML property of the surrounding div object - I am returned the...
5
by: Robin Tucker | last post by:
Hiya, I'm using mshtml and the web browser control to embed an OLE object in my ..NET application. What I want to do is get a reference to the "object" embedded therein: The HTML looks...
4
by: Larry Tate | last post by:
I am wanting to get those cool html error pages that ms produces when I hit an error in asp.net. For instance, when I get a compilation error I get an html error page that shows me the ...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
2
by: Prasad Dannani | last post by:
Hi, I want to know the browser settings like Image Enabled, Cookie Enabled etc., For Cookies and Script Request object has some properties but after disabling certain features also we are...
2
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make...
2
by: dmagliola | last post by:
Hello all, I'm experiencing a problem with ASP.Net for which I can't find a reasonable explanation, or any information. I'm currently developing an application that, through AJAX, asks the...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
3
by: vtpvp82 | last post by:
I am having problem in getting response from remote server for that I have written following script response got correctly but the data on the page is not displayed it gives “–“ in place of grid...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.