Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have two versions of my website: a full site for desktop browsers, and a mobile site which contains mobile-friendly versions of some of the pages from the desktop site. The urls for both sites are identical when viewed from outside, an internal device recognition layer sends users to one site or the other depending on the User Agent.

I would like to configure Apache to detect when someone tries to access a page on the mobile site which does not exist, and forward them on to the same page on the desktop site. Some rule like this is what I have in mind, is it possible?

ErrorDocument 404 http://<ip of desktop site>/<request url without hostname>
share|improve this question
up vote 2 down vote accepted

Using mod_rewrite to foward requests that don't correspond to an existing file or directory

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

For further information you can look at:

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.