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

redirection on a shared server?

I am setting up 4 sites for a small business complex. They wanted to save
money on hosting so asked to have all the sites under one hosting plan, but
with independent domain names. I thought that would be easy, just set up a
domain redirect to a specific folder on the server. Unfortunately I have
since learned that the host does not provide that level of redirection.

Let's say my 4 sites are: restaurant.com, coffeeshop.com, dayspa.com and
bizcomplex.com. The hosting account is set up for bizcomplex.com, and the
other 3 domains are redirected to it. I have set up a folder for each site
on bizcomplex.com's server. The actual URL for a file would be like www
..bizcomplex.com/restaurant/menu.html.

I have written a brief domain sniffer script in ASP that will detect if
someone types in "www. restaurant.com" and automatically move them to the
"restaurant/" folder. However, I can not see how to allow direct linking if
someone types in a complete URL, such as "www. restaurant.com/menu.html"

Any assistance you can provide would be appreciated.

Thank you.
Paul


Jul 22 '05 #1
2 1094
Paul wrote on 18 apr 2005 in microsoft.public.inetserver.asp.general:
I have written a brief domain sniffer script in ASP that will detect
if someone types in "www. restaurant.com" and automatically move them
to the "restaurant/" folder. However, I can not see how to allow
direct linking if someone types in a complete URL, such as "www.
restaurant.com/menu.html"


Make the below include in the top of all asp files.
other files [img etc] must be pointed to absolutely.

<%
snm = lcase(Request.ServerVariables("SERVER_NAME"))
scn = Request.ServerVariables("SCRIPT_NAME")
' allows www. and non www.

if instr(snm ,"restaurant.com")>0 Then
if instr(scn ,"/restaurant")=1 then
response.Redirect scn
end if
Response.Redirect "/restaurant" & scn
elseif instr(snm ,"hotel.com")>0 Then
if instr(scn ,"/hotel")=1 then
response.Redirect scn
end if
Response.Redirect "/hotel" & scn
else
' this file main domain
end if
%>

not tested

further you could test in a custom /404.asp
for files without "/restaurant" or "/hotel"
and redirect them with it.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
Thank you for the sample code. I'll work with that and see what I can do.

Paul
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Paul wrote on 18 apr 2005 in microsoft.public.inetserver.asp.general:
I have written a brief domain sniffer script in ASP that will detect
if someone types in "www. restaurant.com" and automatically move them
to the "restaurant/" folder. However, I can not see how to allow
direct linking if someone types in a complete URL, such as "www.
restaurant.com/menu.html"


Make the below include in the top of all asp files.
other files [img etc] must be pointed to absolutely.

<%
snm = lcase(Request.ServerVariables("SERVER_NAME"))
scn = Request.ServerVariables("SCRIPT_NAME")
' allows www. and non www.

if instr(snm ,"restaurant.com")>0 Then
if instr(scn ,"/restaurant")=1 then
response.Redirect scn
end if
Response.Redirect "/restaurant" & scn
elseif instr(snm ,"hotel.com")>0 Then
if instr(scn ,"/hotel")=1 then
response.Redirect scn
end if
Response.Redirect "/hotel" & scn
else
' this file main domain
end if
%>

not tested

further you could test in a custom /404.asp
for files without "/restaurant" or "/hotel"
and redirect them with it.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #3

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

Similar topics

5
by: Jerry | last post by:
Hi All I would very much appreciate your help: I have two scripts alternating in the background triggering themselves mutually. Here is how: 1.) Script A does something and then calls Script...
52
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. ...
8
by: Sullivan WxPyQtKinter | last post by:
I am now programming python scripts for CGI environment. The redirection has been discussed in this forum for over one hundred times. I have seen most of them, but still have some questions: 1....
8
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
2
by: fReDiNi | last post by:
Hi, I have an strange problem with session variables. I have a site hosted in a local server. I have physic access to this server and its configuration.(apache, php,files...). I have external...
4
by: psual | last post by:
hi newbie in web design I got some issue concerning a secure redirection between 2 pages let say I have a page with a grid (the 'master' page) in this grid I can select a record, get its pk...
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
13
by: Massimo Fabbri | last post by:
Maybe it's a little OT, but I'll give it try anyway.... I was asked to maintain and further develop an already existing small company's web site. I know the golden rule of "eternal" URIs, but...
19
by: fx5900 | last post by:
Hi, i am trying to convert an .osm (openstreetmap) file into gml format and finally to shapefile given this wiki info http://wiki.openstreetmap.org/index.php/GML. I'm using windows and when i...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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.