0

Is there a way to create a link that will in a way do this: If the user goes to http://website1.com/path/to/file and if it results in "404" it doesnt exist, make it automatically navigate to http://website2.com/path/to/file. I want the /path/to/file to carry over but just the domain change.

Is there a way to do this in apache2 running on ubuntu 10.10 server?

1

1 Answer 1

1

You can do this with mod rewrite as follow:

Make sure you have mod rewrite enabled

a2enmod rewrite

Edit your configuration file for your vhost or httpd.conf or .htaccess - which ever way you are setting up your apache server.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://website2.com/$1

You may need to tweak this slightly - you did not provide a lot of details on your setup. But the concept above will work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .