Ivan Ivković Posted February 11, 2012 Share Posted February 11, 2012 Can PHP dynamically change .htaccess files? Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/ Share on other sites More sharing options...
scootstah Posted February 11, 2012 Share Posted February 11, 2012 Sure, it's just a text file. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317025 Share on other sites More sharing options...
requinix Posted February 11, 2012 Share Posted February 11, 2012 ...but there are, like, zero reasons you should ever need to. What are you trying to do? Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317090 Share on other sites More sharing options...
AyKay47 Posted February 11, 2012 Share Posted February 11, 2012 ...but there are, like, zero reasons you should ever need to. What are you trying to do? yeah, I wouldn't really mess around with the .htaccess file using PHP. There should never be a legitimate reason why you would ever need to change .htaccess dynamically. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317092 Share on other sites More sharing options...
scootstah Posted February 11, 2012 Share Posted February 11, 2012 ...but there are, like, zero reasons you should ever need to. What are you trying to do? yeah, I wouldn't really mess around with the .htaccess file using PHP. There should never be a legitimate reason why you would ever need to change .htaccess dynamically. A web-based text editor comes to mind. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317119 Share on other sites More sharing options...
requinix Posted February 11, 2012 Share Posted February 11, 2012 There should never be a legitimate reason why you would ever need to change .htaccess dynamically. A web-based text editor comes to mind. How? [edit] You might be talking about a kind of site administration thing, but in that case the .htaccess is just a normal file you'd want to edit as your site evolves. We're talking about something that needs the .htaccess to change dynamically and (I assume) automatically for whatever reason. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317124 Share on other sites More sharing options...
scootstah Posted February 11, 2012 Share Posted February 11, 2012 Guess I missed the "dynamically" part. Yeah, I don't see why any of the .htaccess rules would need to dynamically change. Except maybe to handle some kind of sub-directory that is dynamically created or something. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317127 Share on other sites More sharing options...
AyKay47 Posted February 12, 2012 Share Posted February 12, 2012 Guess I missed the "dynamically" part. Yeah, I don't see why any of the .htaccess rules would need to dynamically change. Except maybe to handle some kind of sub-directory that is dynamically created or something. Whatever the case may be, there is almost always a better solution than updating .htaccess with PHP. This could lead to very un-wanted results. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317129 Share on other sites More sharing options...
Ivan Ivković Posted February 12, 2012 Author Share Posted February 12, 2012 There should never be a legitimate reason why you would ever need to change .htaccess dynamically. A web-based text editor comes to mind. How? [edit] You might be talking about a kind of site administration thing, but in that case the .htaccess is just a normal file you'd want to edit as your site evolves. We're talking about something that needs the .htaccess to change dynamically and (I assume) automatically for whatever reason. Yes, this is for administration for a CMS that's uber-user-friendly. So yea. You'd have a set of settings for your website that would dynamically change htaccess files based on decision. So you don't really need a developer to set things up. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317181 Share on other sites More sharing options...
trq Posted February 12, 2012 Share Posted February 12, 2012 There should never be a legitimate reason why you would ever need to change .htaccess dynamically. A web-based text editor comes to mind. How? [edit] You might be talking about a kind of site administration thing, but in that case the .htaccess is just a normal file you'd want to edit as your site evolves. We're talking about something that needs the .htaccess to change dynamically and (I assume) automatically for whatever reason. Yes, this is for administration for a CMS that's uber-user-friendly. So yea. You'd have a set of settings for your website that would dynamically change htaccess files based on decision. So you don't really need a developer to set things up. That being the case you would likely use the RewriteMap directive (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap) instead to retrieve data directly from your database rather than using php to rewrite your .htaccess file. Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317183 Share on other sites More sharing options...
Ivan Ivković Posted February 12, 2012 Author Share Posted February 12, 2012 Thanks! Link to comment https://forums.phpfreaks.com/topic/256900-can-php-dynamically-change-htaccess-files/#findComment-1317187 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.