Search code examples
urlalias

permanent alias url for small business website without having to change DNS


Question: Is there a service or a system methodology that would allow someone to setup a permanent base URL that could be used as a referrer to a business website regardless of where that website may be hosted at any given time?

Example: suppose you have two websites that have identical content (they are just mirrored or synched copies) they are hosted by two separate web-hosting companies:

http://example1.org
http://example2.org 

you also have a "permanent url" that you want to use on your business cards:

http://1q2w3e4r5t.org

you then want to allow people to access the "permanent url" (or any path underneath it) and have users redirected to either mirror site of your choosing, without having to change DNS entries.

http://1q2w3e4r5t.org/foobar/hello.php  --> redirect to example1.org/foobar/hello.php
http://1q2w3e4r5t.org/barfoo/bye.asp  --> example2.org/barfoo/bye.asp

This is not a load-balancing or failover architecture, because example1 and example2 are hosted on two completely different commodity low-cost low-reliability web hosting companies.


Solution

  • If you really want to have both domain names pointing to different servers, but redirect all users that reach server a to server b, you (on apache servers) could use mod_rewrite in your .htaccess file:

    RewriteEngine On
    RewriteRule ^(.*)$ http://www.example1.org/$1 [R=301]