elgoog Posted December 9, 2008 Share Posted December 9, 2008 One of my scripts, i need to edit the htaccess file on creation of a new page and add a new line in i am worried that if there is any timeouts or anything that causes the htaccess to part save, it will throw the whole site into a server 500 error. Anyone have any suggestions for how to update a htaccess with minimal risk using a php script, and if somesort of failsafe can be put in? Thanks in Advance.... Quote Link to comment https://forums.phpfreaks.com/topic/136209-risk-free-htaccess-editing-with-php/ Share on other sites More sharing options...
premiso Posted December 9, 2008 Share Posted December 9, 2008 Does the site timeout alot? I do not think the timeout happens a ton, and if it does they just have to go in through ftp and remove the bad .htaccess. Which in essentially means I do not think there is a fail safe way. You could however create the file as a temp file such as htaccess.temp, then if it wrote correctly do a rename from htaccess.temp to .htaccess Quote Link to comment https://forums.phpfreaks.com/topic/136209-risk-free-htaccess-editing-with-php/#findComment-710560 Share on other sites More sharing options...
elgoog Posted December 9, 2008 Author Share Posted December 9, 2008 Site has never timed out before, but if it does and goes down while i am not around it will be a problem. So storing as a temp and renaming sounds like a good solution... will code up and see where it goes from there.. Thanks for the suggestion Quote Link to comment https://forums.phpfreaks.com/topic/136209-risk-free-htaccess-editing-with-php/#findComment-710574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.