2017 © Pedro Pelรกez
 

wordpress-plugin wp-h5bp-htaccess

HTML5 Boilerplate's .htaccess for WordPress

image

roots/wp-h5bp-htaccess

HTML5 Boilerplate's .htaccess for WordPress

  • Thursday, April 30, 2015
  • by retlehs
  • Repository
  • 29 Watchers
  • 156 Stars
  • 14,227 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 34 Forks
  • 4 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

HTML5 Boilerplate's .htaccess for WordPress

Build Status, (*1)

Add HTML5 Boilerplate's .htaccess to your WordPress installation., (*2)

Installation

You can install this plugin via the command-line or the WordPress admin panel., (*3)

via Command-line

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

composer require roots/wp-h5bp-htaccess 2.0.1

Then activate the plugin via wp-cli., (*5)

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., (*6)

!!! 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., (*7)

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., (*8)

/
โ”œโ”€โ”€ 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., (*9)

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., (*10)

Use this for simple string replacements, such as commenting out lines., (*11)

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., (*12)

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

The Versions

30/04 2015

dev-master

9999999-dev http://roots.io/plugins/html5-boilerplate-htaccess/

HTML5 Boilerplate's .htaccess for WordPress

  Sources   Download

MIT

The Requires

 

wordpress

28/04 2015

2.0.1

2.0.1.0 http://roots.io/plugins/html5-boilerplate-htaccess/

HTML5 Boilerplate's .htaccess for WordPress

  Sources   Download

MIT

The Requires

 

wordpress

13/04 2015

2.0.0

2.0.0.0 http://roots.io/plugins/html5-boilerplate-htaccess/

HTML5 Boilerplate's .htaccess for WordPress

  Sources   Download

MIT

The Requires

 

wordpress

07/06 2014

1.1.0

1.1.0.0 http://roots.io/plugins/html5-boilerplate-htaccess/

HTML5 Boilerplate's .htaccess for WordPress

  Sources   Download

MIT

The Requires

 

wordpress