Forum Moderators: phranque

Message Too Old, No Replies

batch .htaccess file editing?

Something to automate the mindless tedium of multi-site .htaccess edits?

         

icpix

3:57 pm on Jul 14, 2004 (gmt 0)

10+ Year Member



I have a dozen or so sites and arrange to keep the top part of their .htaccess files the same (ie with a core set of common rules) with the last half carrying the more site-specific rules.

Pretty much daily 'something' comes along that needs to be included in the .htaccess files' common core rules... The mindless tedium part comes in having to manually copy/paste carefully into the dozen or so sites' .htaccess files. Getting it wrong usually results in lots of Error 500:~(

Is there something I could use to get a master file copy/pasted into the top half of all the nominated sites' .htaccess files?

best wishes, Robert

jdMorgan

4:12 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm...

Well, you could use a script installed on each machine to 'build' the .htaccess file from two components; the common core component, plus the per-server custom component. Set up the script on a cron job to run several times a day to re-generate the .htaccess file. Then all you'd have to do is upload a new core or custom component to each server, and let the script build the new file for you.

If you wanted to get really fancy, you could use a scripting language that can interface to the 'net, and have the script go *get* the newest components from your admin machine, but you'd have to be *very* careful to avoid potential security disasters.

I'm not aware of any simple off-the-shelf solutions, though.

Jim

icpix

4:45 pm on Jul 14, 2004 (gmt 0)

10+ Year Member



Jim

All sites exist right here on my server. I am directly amending the .htaccess files across my intranet ie there are no security issues. I just wondered if there was a simple script I could amend to do the job. I'm not a (PHP) programmer but I am adept at learning how to bodge. Afterall that's how I learnt my .htaccess abilities;~)

best wishes, Robert