For a while I've had a website, that grew and grew for years into several hundred individual php files. About 2 years ago I made a mobile version of the same website. I decided to do this by copying only the main files, and adjusting the header and the footer for mobile friendly. The rest worked as expected; I'd say 50% compatibility at this point.
Some of the sub-directories I decided that instead of copying them I could do a link using ln -s. This has solved the remaining 45%.
Recently I ran into a troubling situation. One of the files inside of this sym-linked subdirectories needs to be drastically different for the mobile version and for the full website. For normal files I would just make a hard copy, and modify the contents, but for a file within a sym-linked directory this is impossible.
Has anyone run into this? How can I solve this?
Here is the file layout & example:
/var/www/domain.com/
/var/www/mobile.domain.com/
/var/www/mobile.domain.com/images -> /var/www/domain.com/images
/var/www/mobile.domain.com/tools -> /var/www/domain.com/tools
If I need to modify a file /tools/help/wizard/configure.php then I can't have a unique file JUST for that file
One approach that I thought of, but don't like is modifying the mobile header file to check something like:
if (file_exists("/var/www/mobile.domain.com/_overwrite_/" . $requested_file)) {
// ... include it instead of running the actual file
}
This seems like an ugly approach. Similar can be done with Apache directives (I don't know them, but I'm guessing it's ModRewrite)
require_once 'header.php';and ends withrequire_once 'footer.php';