On 2011-08-15 12:34, lists.sebast...@abwesend.de wrote:
Hi,

I have an idea on .htaccess files or rather a tiny feature request. :) Before I post it 
to the bugzilla system as a "real" feature request, I wanted to put the idea up 
for discussion. ;) By the way, Apache is a really great piece of software and I like to 
use it! ;)

But first of all one more thing: Yes, I know that .htaccess is only the second best 
alternative and people should rather use httpd.conf BUT in my opinion there are reasons 
"pro" .htaccess (for example, if you can't change the server configuration).

That is the only reason.

IDEA: It was a great thing, if one could cascade/include .htaccess files 
(Include .htaccess-2) or make Apache parse more than one .htaccess file per 
directory (.htaccess-botrestriction, .htaccess-legacyurlrewrite, ...). A 
modular approach for .htaccess files could provide an increased flexibility and 
an improved manageability.

And it would dump your performance even further down the toilet.

Scenario 1:
---
You have big .htaccess files containing anti-bot ip restrictions, legacy URL 
rewrite rules, SEO URL rewrite rules etc.

That would be unwise. Global IP restrictions are under the purview of the administrator and should really go in httpd.conf, or be enforced by a firewall. I furthermore suspect you have no idea what an "anti-bot IP restriction" actually means, since your professed goal - to get noticed by search engines - requires you to very much let bots access your web site.

- Restrict certain IP ranges from accessing your folders/forum/blog/whatever. 
This can be done through .htaccess.

But should be done in httpd.conf whenever possible.

- "Cool URIs don't change" [1]. We all know that. But sometimes you have to change your 
directory structure (e.g. new CMS software) and then it's good to keep the old addresses working 
through "HTTP/301 Moved Permanently" forwardings. This can be done through .htaccess.

But should be done in httpd.conf whenever possible.

- Everybody seems to love SEO URLs. Users and decision makers demand them, 
although there are people who say there's no use in using them.

So if you want to meet the demand, you need to offer these 
/products/my-product-123.html addresses. This can be done through .htaccess.

But should not be done at all.

If one puts all these things into one big file, it can become confusing and 
hard to maintain. It would be easier to keep track of these things if you could 
do something like this:

[Content of .htaccess]
# Some common directives ...
# ...
# Include more .htaccess files:
Include .htaccess-botrestrictions
Include .htaccess-keepalivelegacyurls
Include .htaccess-fancyseourls

httpd.conf fully supports this.

Scenario 2:
---
You develop some web applications locally (local LAMP server/developer machine) 
and often deploy the changes made to your productive environment (virtual 
server on the net, cloud hosting, dedicated server, ...). I have a few of these 
projects and the project files are the same online and offline, apart from one 
config.inc.php (database configuration, paths etc.) and the .htaccess file. I 
exclude the server-specific config.inc.php from synchronizing. So I can just 
upload all the other files without problems (WinSCP or sth. like this). ALL the 
other files? No, there's one file that needs to be merged manually!! :D It's 
the .htaccess file. I can't just overwrite the version on the production server 
with my local file version because there are few lines that need to be 
different. So I have to edit this file manually and be very very careful not to 
put in the local (==wrong) paths on the server.
It would make things much easier, if you could keep more than one .htaccess file. I 
could use one .htaccess-serverspecific, which could be excluded from sync, and one 
.htaccess-common, which could be overwritten (local dev machine ->>  web 
server) airly.

And it would be even more easy when you put the static configuration in httpd.conf, and ONLY put the configuration in htaccess files that you KNOW should be applied to one or the other disparate environments. This enables you to keep the DEV and PROD htaccess files clean and understandable - each applies only to its own environment.

In fact, if you combine the above comment with this requirement, one might posit that the best solution is to maintain different Include files for DEV and PROD, and not to bother with htaccess at all.

Re-creating the entire "config" through htaccess files is just stupid.


These are only two ideas on how these feature could be useful to users.


My 2 ideas on how to do that:
---
1) Allow Include in context .htaccess. See [2].
2) Allow Apache to read more than one .htaccess files per directory (e.g. all 
files with a certain prefix, for example .htaccess-([a-z]+) )


Do you think there might be a chance to suggest this topic to the developers? 
At least *I* would like to have these feature[s] in Apache httpd. :)

Thanks a lot!

Regards,
Sebastian


Web links:
[1] http://www.w3.org/Provider/Style/URI.html
[2] http://httpd.apache.org/docs/2.0/mod/core.html#include


I wonder what you're selling, and why you expect apache.org to help you do it for free.


--
J.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
  "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to