I've taken over a site that caters for client access. They all access there own folder, and in the folder the files have an include with a relative path as below. /core - contains all the actual files /client/file.php - <? include "../core/file.php";?> but with the growing number of clients I want to go a level deeper and separate them better... /uk/client/file.php - <? include "../../core/file.php";?> This is fine but when the files are included, they too have there own relative includes and this is where it breaks. There are so many files I can't easily go through them to change all the include paths so I would like to maybe do a rewrite to fake the path? I've tried this... RewriteRule^uk/$ / But that doesn't work. Any help would be greatly appreciated
I don't know if you can do this with rewrites. The best way would be to have the full path like include /home/yoursite/public_html/core/file.php If you are running the sites on apache and have SSH access simply login and do this : perl -pi -e 's/find/replace/g' *.php or find . -name '*.php' |xargs perl -pi -e 's/find/replace/g' Assuming you have .php files (you need to escape the input like 's/find/replace/g' '/s/include ..\/core\/file.php etc);
Wow you've opened my eyes to a whole new way of thinking! Thank you so much for the reply, it did the trick and will help enormously in the future. Joe