开发者

Is there a major downside to using .htaccess files in your svn/git repository?

开发者 https://www.devze.com 2022-12-30 17:17 出处:网络
If our .hta开发者_Go百科ccess files are purely for mod rewrites, is there a security / development downside to committing .htaccess files alongside other files in your repository?

If our .hta开发者_Go百科ccess files are purely for mod rewrites, is there a security / development downside to committing .htaccess files alongside other files in your repository?

For various reasons (our SEO optimisers like to add pretty urls as new promotions occur, etc) we need a fair few rewrite rules inside these files. Would I be better off pushing the routing into php-land and dealing with it there? Or is reading from a .htaccess via apache fine?

The .htaccess files are not exposed via the web server, so that's not a security risk.


As I recall, once you use one .htaccess file, you already have agreed to pay the price, that price being apache will look all over the place, every request, for .htaccess files. That's a performance issue though.

I think your ideal solution is to not use .htaccess files at all, but set those rules in httpd.conf. PHP is not better at redirection than apache, so no help there. That's the performance answer. Develop however feels best, and then for production move the rules into the server core.

As for version control, if it is a file full of text, that is needed for the code, then yes, I would put it into version control. I'd do that right now in fact. If many people are adding in their own redirect rules in .htaccess files all over the place, you'll want to be able to:

  1. Roll back the changes.
  2. Point the finger! ;)


.htaccess mod_rewrite is waaaaaay faster than routing things on the php side, i would stick with mod_rewrite for url manipulation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号