473,320 Members | 2,071 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.

tell which domain the user is accessing?

Hi,

I've got a site which Google is indexing 3 different ways:
glassgiant.com
host5.veoweb.net/~glassgia
veodns.com/glassgia

I only want people accessing it the first way. If they access it any
way but through the domain, I would like to send a moved permanently
code, or at least use a header("Location: blah blah blah").
Unfortunately, I can't figure out how to detect anything before the
first slash in the URL. Any suggestions?

Thanks,
Shawn

--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 16 '05 #1
2 5669
Shawn Wilson wrote:
Hi,

I've got a site which Google is indexing 3 different ways:
glassgiant.com
host5.veoweb.net/~glassgia
veodns.com/glassgia

I only want people accessing it the first way. If they access it any
way but through the domain, I would like to send a moved permanently
code, or at least use a header("Location: blah blah blah").
Unfortunately, I can't figure out how to detect anything before the
first slash in the URL. Any suggestions?


If you have access to mod_rewrite on your server, create a .htacccess
file with the following:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.glassgiant\.com [NC]
RewriteRule ^/~glassgia(.*) http://www.glassgiant.com$1 [R=301]

RewriteCond %{HTTP_HOST} ^www.veodns.com [NC]
RewriteRule ^/glassgia(.*) http://www.glassgiant.com$1 [R=301]

This would send a status code of 301 (moved permanently), and redirect
the request.

HTH

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 16 '05 #2
sam
<?php

// the name of the host => http://$host_name/bla/bla/index.php
$host_name = $_SERVER['HTTP_HOST'];

// if we don't find glassgiant.com in the host_name, we redirect
if(!ereg("glassgiant.com",$host_name))
header("Location: http://glassgiant.com");
?>
Shawn Wilson <sh***@glassgiant.com> wrote in message news:<3F***************@glassgiant.com>...
Hi,

I've got a site which Google is indexing 3 different ways:
glassgiant.com
host5.veoweb.net/~glassgia
veodns.com/glassgia

I only want people accessing it the first way. If they access it any
way but through the domain, I would like to send a moved permanently
code, or at least use a header("Location: blah blah blah").
Unfortunately, I can't figure out how to detect anything before the
first slash in the URL. Any suggestions?

Thanks,
Shawn

Jul 16 '05 #3

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

Similar topics

1
by: jach | last post by:
How can I get the domain, username and PC network name (Win 2000 Pro & Win XP Pro PC's) of the current logged on user (logged onto a domain and access an intranet page, Window 2000 server running...
1
by: Daniel | last post by:
If i log into my computer as domain A and user X and password Y but then I need to give C# application access to domain B as user F and password G. Is this possible? or do i have to log into the...
0
by: Buddy Ackerman | last post by:
I have an application where the client wants AD integration. The application requires that the user accounts reside in the app's database. The application is a (.NET) webservices based app where...
4
by: Svend Tofte | last post by:
Hey, I'm doing some webapplications, and in one of them, I want to open a page, from another domain. This is running internally, with full control over the enviroment. However, even adding the...
3
by: Baron | last post by:
an asp.net page on Machine A is trying to access files on several machines of different domains.. any 'good' method to do it without mapping drive in prior..... i've read something called...
3
by: musosdev | last post by:
Hi guys I've got the following error on a project which is running locally on a vs2005 machine (built in webserver), trying to connect to my win2k3 server active directory. the error is... ...
5
by: yawnmoth | last post by:
If running off of the local filesystem, in Firefox, or if the security settings are set appropriately, in Internet Exporer, XmlHttpRequests can be sent to any domain of your chosing. But what...
3
by: Oren | last post by:
Hello, I tried to get UserName and Domain by doing: System.Collections.Specialized.NameValueCollection var = Request.ServerVariables; string sLogonUserArr = var.ToString().Split('\\'); It's...
2
by: Tessa | last post by:
Hi, We have a .net web application, and are trying to use PrinterSettings.InstalledPrinters to list the printers installed on the webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)...
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
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
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...

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.