Title: Custom .htaccess rules manager
Author: Peter Duchnovsky
Published: <strong>21. Juli 2025</strong>
Last modified: 24. Juli 2025

---

Search plugins

![](https://ps.w.org/custom-htaccess-rules/assets/icon.svg?rev=3331175)

# Custom .htaccess rules manager

 By [Peter Duchnovsky](https://profiles.wordpress.org/pdux/)

[Download](https://downloads.wordpress.org/plugin/custom-htaccess-rules.1.0.0.zip)

 * [Details](https://ltz.wordpress.org/plugins/custom-htaccess-rules/#description)
 * [Reviews](https://ltz.wordpress.org/plugins/custom-htaccess-rules/#reviews)
 *  [Installation](https://ltz.wordpress.org/plugins/custom-htaccess-rules/#installation)
 * [Development](https://ltz.wordpress.org/plugins/custom-htaccess-rules/#developers)

 [Support](https://wordpress.org/support/plugin/custom-htaccess-rules/)

## Description

The “Custom .htaccess rules manager” plugin provides a secure and intuitive interface
within your WordPress admin dashboard to manage custom rules for your .htaccess 
file. This powerful tool allows you to insert specific rules at both the very beginning
and very end of your .htaccess file, ensuring they are applied correctly without
interfering with WordPress’s own core rules.

### Key Features

#### Top and Bottom Blocks

Dedicated sections to add rules that appear before and after WordPress’s standard.
htaccess content.

#### Shell-Mode Syntax Highlighting

Makes writing and reviewing .htaccess rules easier with clear visual cues.

#### Auto-Expanding Editor

The editor automatically adjusts its height to fit your content, providing a comfortable
editing experience.

#### Automatic Backups

Every time you save new rules, a backup of your existing .htaccess file is automatically
created, providing a safety net.

#### Backup Restoration

Easily restore your .htaccess file from a list of the last 10 backups directly from
the plugin settings page.

#### Uninstall Options

Choose whether to delete .htaccess backups or keep them on your server when uninstalling
the plugin.

#### WordPress Filesystem API Integration

All file operations are performed using WordPress’s robust WP_Filesystem API, ensuring
compatibility and security across various hosting environments.

### Important Note

Modifying the .htaccess file incorrectly can lead to your website becoming inaccessible.
Always exercise caution and ensure you understand the rules you are adding. The 
backup feature is designed to help, but careful testing is always recommended.

## Screenshots

 * [[
 * screenshot-1.png

## Installation

Upload:

Download the plugin ZIP file from the WordPress.org plugin directory.

Go to your WordPress admin dashboard, navigate to Plugins > Add New.

Click on the “Upload Plugin” button at the top.

Choose the downloaded ZIP file and click “Install Now”.

Activate:

Once installed, click “Activate Plugin”.

Configure:

Go to Settings > Custom .htaccess in your WordPress admin menu.

Add your desired rules in the “Top of File” and “Bottom of File” text areas.

Click “Save Rules”.

You can also manage backups and uninstall options from this page.

## FAQ

### What is the .htaccess file?

The .htaccess file is a powerful configuration file used by Apache web servers. 
It allows for decentralized management of web server configuration on a per-directory
basis, enabling features like URL rewriting, access control, password protection,
and more, without needing to modify the main server configuration.

### Why are there “Top of File” and “Bottom of File” sections?

WordPress automatically manages certain parts of your .htaccess file. Placing custom
rules at the very top or very bottom ensures they are processed either before WordPress’s
default rules (top) or after them (bottom), preventing conflicts and ensuring your
rules are applied as intended.

### What kind of rules can I add?

You can add various Apache directives, such as:

Redirections (Redirect, RewriteRule)

Blocking IP addresses or user agents

Setting custom error pages

Modifying caching headers

Disabling directory browsing

Enforcing HTTPS

And many more!

Always ensure the rules you add are valid Apache directives.

### What if I break my site?

The plugin creates a backup of your .htaccess file every time you save changes. 
If your site becomes inaccessible after saving rules, you can:

Access your site via FTP or your hosting’s file manager.

Navigate to your WordPress root directory and find the .htaccess file.

Go to wp-content/uploads/htaccess-backups/.

Download the most recent backup file (e.g., .htaccess-backup-YYYYMMDD-HHMMSS.bak).

Rename your current, problematic .htaccess file (e.g., to .htaccess_old).

Upload the backup file and rename it to .htaccess.

Alternatively, if you can still access your WordPress admin, go to Settings > Custom.
htaccess and use the “Restore Selected Backup” option.

### How many backups are kept?

The plugin keeps the last 10 backups of your .htaccess file. Older backups are automatically
discarded to save space.

### What happens to my backups when I uninstall the plugin?

On the Settings > Custom .htaccess page, there’s an “Uninstall Options” section 
where you can choose whether to “Delete all plugin data (including .htaccess backups)
upon uninstallation” or “Keep .htaccess backups on the server upon uninstallation.”
This gives you control over your data.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Custom .htaccess rules manager” is open source software. The following people have
contributed to this plugin.

Contributors

 *   [ Peter Duchnovsky ](https://profiles.wordpress.org/pdux/)

[Translate “Custom .htaccess rules manager” into your language.](https://translate.wordpress.org/projects/wp-plugins/custom-htaccess-rules)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/custom-htaccess-rules/),
check out the [SVN repository](https://plugins.svn.wordpress.org/custom-htaccess-rules/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/custom-htaccess-rules/)
by [RSS](https://plugins.trac.wordpress.org/log/custom-htaccess-rules/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.0.0

Initial release of the Custom .htaccess rules manager plugin.

Features include: Top and Bottom rule blocks, shell-mode syntax highlighting, auto-
expanding editor, automatic .htaccess backups, backup restoration, and uninstall
options.

Full integration with WordPress Filesystem API for secure file operations.

## Meta

 *  Version **1.0.0**
 *  Last updated **9 Méint ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 5.0 or higher **
 *  Tested up to **6.8.5**
 *  PHP version ** 7.4 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/custom-htaccess-rules/)
 * Tags
 * [backup](https://ltz.wordpress.org/plugins/tags/backup/)[editor](https://ltz.wordpress.org/plugins/tags/editor/)
   [htaccess](https://ltz.wordpress.org/plugins/tags/htaccess/)[security](https://ltz.wordpress.org/plugins/tags/security/)
 *  [Advanced View](https://ltz.wordpress.org/plugins/custom-htaccess-rules/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/custom-htaccess-rules/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/custom-htaccess-rules/reviews/)

## Contributors

 *   [ Peter Duchnovsky ](https://profiles.wordpress.org/pdux/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/custom-htaccess-rules/)