开发者

Redirect URL to another URL

I 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 ensur开发者_JAVA技巧e that even though users have old URLs in their emails, when clicking on this old URL, actually hop over to new correct URL.


  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.


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.


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]


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">

Hope this helps.


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.


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


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


Or using a php script on the old location:

<?php
    header( 'Location: http://new_page.html' ) ;
?>


<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜