Click here to Skip to main content
15,885,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
TLDR: I want a class that lets me interact with htaccess and httpd.conf files programmatically. Does it exist?

Full Version:
I was thinking of making a PHP class for interacting with server configuration (ie httpd.conf / htaccess files) for performing various common activities.

Myself, I mainly just like working with programmatic objects so very much more than these configuration files. Additionally, it has the potential of treating these files intelligently, using htaccess or httpd.conf or both, depending on what is the most advantageous / available.

I figure that this might also be handy for projects that work with these sorts of configurations regularly.

I need to know if this already exists, before I sink a bunch of time into it. (see class wishlist below)

If something like this already exists, please point me that way! If not, would there be any interest in working on something like this? It sounds like a handy open source project.

Thanks,
-TheOnlyMerlin

Config Wishlist:
Base Function: intelligent insertion
-This attempts to apply a given rule (such as a rewrite rule) to htaccess / httpd.conf as needed. If nothing else, this could be convenient for working with the configuration files. This would be the base function that the other functions call, but with different parameters.
-Parameters:
--Rule - the rule to apply
--Apply When - You specify whether you want it now, later, or both.
---Apply now: Makes the change in the relevant htaccess file
---Apply Later: Make changes in httpd.conf, requires config reload to take effect.
---Apply Both: Make changes in both htaccess and httpd.conf.
--Folder List - List of folders the rules apply to.
Common rewrite rules
-ie remove file extensions from URL, view current rewrite rules
...
Access control
-User Management
--ie, Add / remove users using primitive user access control, View current users (in combination with Htpasswd files)
-IP Address access
--ie ban users by IP, only allow from a given ip list, etc.
-By file type
--ie disallow access to all file types except certain types, disallow access to .php.class files in particular, etc
Configuration Changes
-ie mime types, error responses, directory listing, cache control, server side includes, etc
Work with types
-ie allow php in html files, allow php in php.class files, disallow php in anything but .php files, etc.
View rules
-See universal rules, or rules that apply to a particular directory (compile httpd.conf and htaccess files)
Etc
-And anything else I happen to think of to add in.
Posted
Updated 29-Oct-13 20:18pm
v2
Comments
Prasad Khandekar 30-Oct-13 2:30am    
Hi,

Very nice idea, please go ahead and implement one. I have not found one so far.

Regards,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900