• This repository has been archived on 09/Mar/2021
  • Stars
    star
    153
  • Rank 235,853 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WordPress plugin that adds HTML5 Boilerplate's .htaccess

HTML5 Boilerplate's .htaccess for WordPress

Build Status

Add HTML5 Boilerplate's .htaccess to your WordPress installation.

Installation

You can install this plugin via the command-line or the WordPress admin panel.

via Command-line

If you're using Composer to manage WordPress, add wp-h5bp-htaccess to your project's dependencies.

composer require roots/wp-h5bp-htaccess 2.0.1

Then activate the plugin via wp-cli.

wp plugin activate wp-h5bp-htaccess

via WordPress Admin Panel

  1. Download the latest zip of this repo.
  2. In your WordPress admin panel, navigate to Plugins->Add New
  3. Click Upload Plugin
  4. Upload the zip file that you downloaded.

Configuration

The plugin will work right out of the box, but we have made some options available to developers who wish to fine-tune the resulting .htaccess file.

!!! WARNING !!!

Using these configuration options can result in unexpected, undesired, and even damaging behaviors. You must understand that changing the output of this plugin will change what WordPress puts into your .htaccess file. Misconfigured .htaccess files will likely result server errors. Be sure that you have a way of removing the .htaccess file if necessary.

Use a custom server config (server_configs.conf)

You can use your own server config instead of the included Apache Server Config by H5BP. Do this by placing a file named server_configs.conf in the root of your theme directory.

/
├── wp-admin/
├── wp-content/
│   └── themes/
│       └── your-theme-here/
│           └── server_configs.conf
└── wp-includes/

Hooks

There are a few WordPress filters into which a developer can hook to modify the resulting .htaccess file. The rules below are listed in the order in which they are applied in the code.

roots/h5bp-htaccess-filters

This hook passes an associative array of modification filters to be applied to the rules where the keys of the array represent a string that is to be searched and the values of the array represent a replacement.

Use this for simple string replacements, such as commenting out lines.

add_filter('roots/h5bp-htaccess-filters', function($rules_filters) {
  // comments out all `RewriteRule`s
  $rules_filters['RewriteRule'] = '# RewriteRule';
  return $rules_filters;
});

roots/h5bp-htaccess-rules

This hook passes a string containing all of the rules that are going to be added to your .htaccess file by this plugin.

add_filter('roots/h5bp-htaccess-rules', function($server_config_rules) {
  // Removes all comments and whitespace
  return preg_replace(['/#.*/', '/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/'], ['',PHP_EOL], $server_config_rules);
});

Changelog

2.0.1: April 29th, 2015

  • Fix reference error (#12)
  • Update link to h5bp server config repo (#13)

2.0.0: April 11th, 2015

  • Update to Apache Server Configs v2.14.0
  • Rewrote plugin as a class
  • Rewrote logic so that server and WordPress configurations are only checked when plugin is actively in use
  • Added filters to provide users with more control over the rules that are being applied
  • Added a dedicated WordPress section to the bottom of h5bp-htaccess

1.1.0: June 7th, 2014

  • Update to Apache Server Configs v2.4.1

1.0.0: April 30th, 2013

License

More Repositories

1

sage

WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
PHP
12,542
star
2

bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure
PHP
6,069
star
3

trellis

WordPress LEMP stack with PHP 8.2, Composer, WP-CLI and more
Jinja
2,466
star
4

soil

WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications
PHP
1,024
star
5

acorn

Laravel components for WordPress plugins and themes
PHP
682
star
6

wp-password-bcrypt

WordPress plugin to implement secure bcrypt hashed passwords
PHP
612
star
7

roots-example-project.com

Example Roots stack project (Trellis, Bedrock, Sage)
Jinja
459
star
8

wp-stage-switcher

WordPress plugin that allows you to switch between different environments from the admin bar
PHP
367
star
9

bud

High-performance build system that supports SWC, esbuild, and Babel
TypeScript
318
star
10

sage-woocommerce

WooCommerce integration for Sage 9 themes
PHP
213
star
11

bedrock-capistrano

Capistrano configs/integration for Bedrock
Ruby
178
star
12

docs

📝 Documentation for Roots projects
168
star
13

trellis-cli

A CLI to manage Trellis projects
Go
163
star
14

wordpress

Automatically updated WordPress composer package
163
star
15

roots-sass

Deprecated in favor of Sage
132
star
16

clover

WordPress plugin boilerplate
JavaScript
82
star
17

capistrano-grunt

Capistrano extension for Grunt tasks
Ruby
67
star
18

roots-rewrites

Unsupported: Clean URL rewrites for WordPress assets
PHP
62
star
19

multisite-url-fixer

Fixes WordPress issues with home and site URL on multisite when using Bedrock
PHP
57
star
20

sage-translations

Community translations for the Sage WordPress starter theme
Shell
51
star
21

wp-config

Bedrock's failsafe wp-config
PHP
51
star
22

wordpress-nginx

Chef cookbook to create Nginx sites for WordPress applications
Ruby
48
star
23

roots-wrapper-toolbar

WordPress plugin that displays the base and main templates selected by the Roots wrapper in the WordPress toolbar
PHP
48
star
24

palette-webpack-plugin

Generate a JSON file containing your color palette from existing Sass maps and/or Tailwind.
JavaScript
46
star
25

roots-cli

*Pre-alpha* Start a new Roots project with one command
Go
41
star
26

grunt-wp-assets

Unsupported: WordPress assets revisioning
JavaScript
40
star
27

bedrock-autoloader

Bedrock Autoloader enables standard plugins to be required just like must-use plugins
PHP
38
star
28

wordpress-packager

Helper to generate WordPress Composer packages
PHP
37
star
29

issue-closer-action

GitHub action to automatically close issues/PRs that don't match a regexp
JavaScript
34
star
30

sage-installer

Sage 9 installer
PHP
30
star
31

setup-trellis-cli

👷 Sets up Trellis CLI for GitHub Action workflows
JavaScript
28
star
32

acorn-prettify

Acorn Prettify contains a collection of modules to apply theme-agnostic front-end modifications to your Acorn-powered WordPress sites.
PHP
27
star
33

bedrock-docker

https://roots.io/bedrock/
Dockerfile
25
star
34

sage-cli

Perform tasks with the Sage theme
TypeScript
21
star
35

wp-cli-theme-activation

WP-CLI command for theme activation and setting options
PHP
19
star
36

acorn-example-package

A template for creating your own Acorn packages
PHP
18
star
37

grunt-wp-version

Unsupported: This project has been replaced with https://github.com/roots/grunt-wp-assets
JavaScript
18
star
38

wp-cookbook

Chef cookbook for WordPress sites
Ruby
17
star
39

wordpress-full

Automatically updated WordPress composer package (full version, with wp-content and themes)
16
star
40

wp-blade-check

Checks and displays an admin notice if your uncompiled Blade templates are publicly accessible
PHP
16
star
41

guidelines

Coding and contributing guidelines for Roots projects
16
star
42

wordpress-no-content

Automatically updated WordPress composer package (version without wp-content)
13
star
43

js-dom-router

JavaScript DOM Router
TypeScript
13
star
44

acorn-mail

Simple WordPress SMTP using Acorn.
PHP
13
star
45

bedrock-disallow-indexing

Disallow indexing of your site on non-production environments.
PHP
12
star
46

sage-lib

Library files for Sage 9
PHP
12
star
47

acorn-fse-helper

Bootstrap FSE support in Acorn-based WordPress themes.
PHP
12
star
48

gutenberg-examples

8
star
49

.github

Default community health files for GitHub projects
TypeScript
7
star
50

vsce-blade-syntax

Roots specific syntax highlighting for blade template files
5
star
51

bud-generators

Standard generator library for @roots/bud.
HTML
5
star
52

discourse-topic-github-release-action

Post published GitHub releases from a repository to a Discourse instance.
JavaScript
4
star
53

dockerfiles

Dockerfile
4
star
54

trellis-deploy-action

GitHub Action for deploying Trellis sites
4
star
55

ansible-role-mailpit

Ansible Role - Mailpit email testing for developers
Jinja
3
star
56

homebrew-tap

Ruby
3
star
57

wordpress-generator-legacy

Legacy generator for the roots/wordpress Composer package. See https://github.com/roots/wordpress-packager for the current version.
PHP
1
star
58

support

PHP
1
star