Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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: www.phpriot.com

share|improve this answer

Your Answer

 
discard

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.