Hi Terry,
> We meant to ask this question last night, but neither Paul, nor myself 
> remembered it.
>
> We are currently going through a rebranding exercise at work and at the same 
> time moving chunks of our website from a hosted service to a local webserver. 
>  
> However, we only have one IP address for that server.
>
> Paul has purchased the domain names and dealt with the DNS side of things.  
> As 
> it stands all of our web addresses point to the same IP address, which 
> contains the core information at the top level.  However, we have several sub-
> domains which we would like to have automatically redirected when visitors 
> arrive, but we can't quite decide the best way to do it.  In summary we have:
>
> Our IP Address:       ->      Web address 1   ->      Top level content
>                               ->      Web address 2   ->      /sub-directory  
> ->      Sub-domain 1
>                                       etc.
>
> We had this once before and used some kind of code in the header of Index. 
> html at the top level to do the redirection, but we know that there are other 
> ways to do it, such as Apache config, Javascript and so on.
>
> We would prefer to use the code in Index.html, but the original code got 
> washed out with the bathwater several rebrandings ago.  We're not keen on 
> Javascript, because of the number of people who now browse with some kind of 
> Noscript set (as I do).
>
> Does anyone have any comments on the pros and cons of the various techniques 
> and perhaps give us some pointers?
>
If you're using Apache as webserver, it's probably mod-rewrite you need
to have enabled, and update the config for the site to do the job.

 - http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Is the content static, or are you using some sort of database driven
server side scripts to generate content (ie a CMS etc?). Some 'web
frameworks' have their own internal routing which may be of use. I don't
think you need javascript to do the job - as you say it's risky if folk
have it switched off.

It's hard to give pros and cons without knowing a bit more about the
site, but by the sounds of it (serving different content depending on
URL), mod-rewrite should be able to handle that. You may need to look
into 'virtual hosts' if the base address is different, but i think a
sub-domain can be configured inside the basic web server config if
necessary.

Oh - and Apache and Apache2 can do things slightly differently depending
on how sites are set up. There's "sites-enabled/disabled" (look up
a2ensite/a2dissite) on Apache2 for virtual hosts (ie different urls on
the same IP address. nb SSL sites have to have their own IP address,
unless on a sub-domain)

Hope that helps,

Stephen

-- 
______________________________
Stephen Wolff

email: [email protected]
mobile: (+44) 7801 261 466
Skype:  stephendwolff
linkedin.com/in/stephendwolff

Max Gate Digital Ltd
Consultancy - Projects - Services - Research - Software Development

39 Kingsbere Crescent
Dorchester
Dorset
DT1 2DY
_________________________________

Please consider the environment before printing this email


-- 
Next meeting:  Bournemouth, Tuesday, 2015-02-03 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:[email protected]
How to Report Bugs Effectively:  http://goo.gl/4Xue

Reply via email to