aklump/htaccess-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aklump/htaccess-manager

Composer 安装命令:

composer create-project aklump/htaccess-manager

包简介

README 文档

README

htaccess

Summary

A PHP tool for .htaccess management in your web projects.

  • Allows you to include .htaccess files in other .htaccess files.
  • Work with smaller files then combine using ./bin/htaccess build
  • Share common snippets across different .htaccess files.
  • Simplified URL redirection; remap old URLs to new without nasty syntax.
  • Merge in remote .htaccess source files on build (think Drupal web root .htaccess + custom .htaccess directives).
  • Manage banned IPs in a separate file or add them to the YAML configuration.

Quick Start

  • Create a YAML configuration file in a secure location in your project.
  • Refer to config.example.yml as a guide and optionally, delete when done.
  • Lastly, build your files using ./vendor/bin/htaccess build path/to/your/config.yml

Install with Composer

  1. This package requires some unpublished packages. You must add the following to composer.json in the repositories array:

    {
     "type": "github",
     "url": "https://github.com/aklump/json-schema-loading"
    },
    {
     "type": "github",
     "url": "https://github.com/aklump/json-schema-validation"
    },
    {
     "type": "github",
     "url": "https://github.com/aklump/json-schema-merge"
    }
  2. Require this package:

    composer require aklump/htaccess-manager:^0.0
    

Configuration Special Notes

  • You must list one or more hosts in valid_hosts, including their http or https protocol.
  • Forced SSL redirection is detected based on the valid_hosts array; force_ssl will be set to true if all valid_hosts use the https protocol. You may override auto-detection by setting force_ssl to true or false.
  • Adding or removing www. is detected based on the valid_hosts array. It is set to add if all valid_hosts have www., remove if all valid_hosts do not have www.. When neither add nor remove no redirection takes place. You may override auto-detection by setting www_prefix to add, remove, or default.

Usage

  • To view help execute ./vendor/bin/htaccess

Environment Variable Substitution

The configuration file supports environment variable substitution. You can use $VAR_NAME or ${VAR_NAME} syntax in both keys and values of the YAML file. Using ${VAR_NAME} is recommended to avoid ambiguity when a variable is immediately followed by other characters. This is useful for creating template-like configurations that can be customized per project.

files:
  ${PROJ_ID}:
    title: $PROJ_TITLE
    valid_hosts:
      - https://example.com
    output:
      - ${PROJ_DIR}/web/.htaccess

When running the build command, provide the environment variables:

PROJ_ID=myproject PROJ_TITLE="AKlump's Web Factory" PROJ_DIR=./path ./bin/htaccess build config.yaml

Support My Open Source Work

If you’ve found this project useful, please consider supporting its ongoing maintenance. Even a small contribution helps fund updates, fixes, and new ideas.

More Reading

Troubleshooting

4xx redirects are not working

I'm not sure why, but on some servers they do not work. Possible reasons:

  1. Apache version?
  2. VirtualHost config hijacking?
  3. Drupal conflict?

aklump/htaccess-manager 适用场景与选型建议

aklump/htaccess-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 aklump/htaccess-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aklump/htaccess-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 aklump/htaccess-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2024-11-26