Re: Redirecting to the same webspace but different domain
- From: David Dorward <dorward@xxxxxxxxx>
- Date: Wed, 11 Jan 2006 19:14:26 +0000
Lisa wrote:
> I have a website which amongst other things has a message forum which
> uses cookies to allow users to login. I am in the process of changing
> the domain of the site and ideally want the old address to automatically
> redirect to the new one so that cookies will be created and read for the
> new site address.
This isn't something that can be sensibly handled with HTML.
On the old domain:
1. Generate a one time only authorisation token.
2. Store the cookie data on the server with the token.
3. Send a 301 Redirect HTTP response to the user along with a location
header that redirects them to a server side on the new site. Include, in
the query string of that URL, the auth token and the page they were trying
to visit.
On the new domain (in the aforementioned server side script):
1. Use the auth token to look up their credentials in the database
2. Send a 302 redirect response which includes headers to set their cookies
and redirect them to the page they were trying to get to in the first place
(although on the new domain)
3. Delete the auth details from the database
(This does assume that when you say "changing the domain" you don't mean
"changing the domain and server". Coping with transmitting the
authentication details to the new server as well will make things a little
more complicated).
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
.
- Prev by Date: Re: HTML entities from input fields
- Next by Date: Re: Redirecting to the same webspace but different domain
- Previous by thread: Re: HTML entities from input fields
- Next by thread: Re: Redirecting to the same webspace but different domain
- Index(es):
Relevant Pages
|