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.

Link to comment
Share on other sites

...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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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