Jump to content

Can PHP dynamically change .htaccess files?


Ivan Ivković

Recommended Posts

...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.

...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.

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.

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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.