Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to create a link that will in a way do this: If the user goes to and if it results in "404" it doesnt exist, make it automatically navigate to 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?

share|improve this question
mod_rewrite with appropriate condition might work. – Daniel Beck May 1 '13 at 14:41
up vote 1 down vote accepted

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 ^(.*)$$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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.