views:

64

answers:

9

Hi,

I have the following scenario and unsure how to go about solving it.

Basically have the following page that a user can go to by where this URL exists within their email.

For example: http://www.abc.example/yourdetails.html

My question is, I have now been told that this whole web app is being moved to a new domain, i.e.

http://www.xyz.example/yourdetails.html

Assume there are no issues with accessing the two domains within the network (intranet), how can I redirect the user when clicking on a link in an email that is no longer the correct link to actually call the new URL:

http://www.abc.example/yourdetails.html

I basically want to ensure that even though users have old URLs in their emails, when clicking on this old URL, actually hop over to new correct URL.

Hope this makes sense.

Thanks.

A: 
<script>
window.location='http://newurl.com/page.html'
</script>

or even better (just one snippet for all pages)

<script>
window.location='http://newurl.com'+window.location.pathname
</script>
Christian Smorra
What if javascript isn't enabled.
Ash Burlaczenko
Well, in that case you can do htaccess + php + html + javascript "4 in 1" redirect and email users on top of that. Something from this should work, but might be a lil overkill...
Im0rtality
@Ash: i somehow misread the question i thought this was tagged with javascript
Christian Smorra
@Christian: because it was tagged with javascript
Im0rtality
+1  A: 

Until you can send out new emails with the proper domain you will want to use a 301 permanent redirect on the xyz.com domain. You can use an .htaccess file to do this. Google for information specific to your webserver. This Site seems to have good information specific to Apache.

Jay
A: 

Add this meta tag to the top of your page on the abc domain.

<META HTTP-EQUIV="refresh" CONTENT="0;URL=http://www.xyz.com/yourdetails.html"&gt;

Hope this helps.

Ash Burlaczenko
A: 

A URL by definition points to a single web resource, what you can do is configure your web server to map multiple URLs to the same web resource.

Please refer to this for more info, on how to do this on Apache.

StudiousJoseph
+2  A: 
  1. If the site is not changing structure, you can point the xyz.com domain to abc.com in DNS.

  2. I think you can configure apache, using modrewrite, to rewrite calls from the old domain to the new one. You might not be able to do this if the domains are on different servers.

  3. You can edit the page at http://www.xyz.com/yourdetails.html and add a redirect header (and maybe an explanation) to redirect to the new page.

Scott Saunders
A: 

If you're on an apache server, this sounds like a job for mod_rewrite.

try http://corz.org/serv/tricks/htaccess2.php http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html

CEich
A: 

By Apache's mod_rewrite module. You could create something like (on the old domain):

RewriteRule ^yourdetails.html$ http://www.xyz.com/yourdetails.html [R=301,L]

Prot0
A: 

in PHP: < ?php header("Location: http://www.abc.com/yourdetails.html"); ?>

Im0rtality
A: 

Or using a php script on the old location:

<?php
    header( 'Location: http://new_page.html' ) ;
?>
aniri
The page file is html.
Ash Burlaczenko