Prevent other plugins from removing WP Ghost’s rewrite rules by placing them inside the WordPress rules section of .htaccess. By default, WP Ghost writes its rewrite rules outside the # BEGIN WordPress / # END WordPress block in .htaccess. Some plugins (especially security and optimization plugins) clean up custom rules outside this block, breaking WP Ghost’s path changes. Enabling this option moves WP Ghost’s rules inside the WordPress section where they’re protected from removal. Apache and LiteSpeed servers only. This is a free feature.
What Is Rewrites Rules Location?

The Rewrites Rules Location setting controls where WP Ghost places its rewrite rules in the .htaccess file. By default, WP Ghost writes its rules outside the WordPress block (above or below the # BEGIN WordPress / # END WordPress comments). When you enable Add Rewrites in WordPress Rules Section, WP Ghost moves its rules inside that block. This protects them from being deleted by other plugins that clean up non-WordPress rules from .htaccess.
The WordPress .htaccess structure looks like this:
# BEGIN WordPress
(WP Ghost rules go here when option is enabled)
(WordPress permalink rules)
# END WordPressWhen to Enable This Option
Most users don’t need this. Enable it only when you see one of these specific problems:
Custom paths stop working after saving another plugin’s settings. Another plugin is regenerating the .htaccess file and removing WP Ghost’s rules in the process. This commonly happens with security plugins, optimization plugins, or hosting-level tools that “clean” the .htaccess file.
WP Ghost’s rewrite rules disappear from .htaccess repeatedly. You re-save WP Ghost settings and the rules come back, but they vanish again after a while. A scheduled task or another plugin is periodically rewriting the file.
Your hosting provider’s control panel resets .htaccess. Some hosting panels regenerate .htaccess during updates or maintenance but preserve the # BEGIN WordPress / # END WordPress block. Moving rules inside that block keeps them safe.
How to Enable Rewrites in WordPress Rules Section
- Go to WP Ghost > Advanced > Compatibility.
- Switch on Add Rewrites in WordPress Rules Section.
- Click Save.

After saving, WP Ghost moves its rewrite rules from the custom section into the # BEGIN WordPress / # END WordPress block. Verify your site is working by opening an incognito browser and checking the homepage, internal pages, and custom login path.
Automatic cleanup: WP Ghost removes all its rewrite rules from .htaccess on plugin deactivation, regardless of where they were placed. No manual cleanup needed.
Troubleshooting
Custom paths break after enabling this option
Placing rules inside the WordPress block can change the order in which Apache processes them. If custom paths return 404 or redirects loop, disable this option and use the default rule placement instead. Use the Safe URL parameter to bypass WP Ghost temporarily if needed.
Rules still get removed after enabling this option
The other plugin may be rewriting the entire .htaccess file, including the WordPress block. Identify which plugin is doing it (check recently installed or updated plugins), and configure that plugin to preserve custom rules. If you can’t prevent the removal, re-save WP Ghost settings after the other plugin runs to regenerate the rules.
Site shows errors or white screen
Use the emergency disable guide, the rollback settings, or add a constant in wp-config.php to disable WP Ghost temporarily. Then switch this option back off before re-enabling WP Ghost.
Frequently Asked Questions
Does this work on Nginx?
No. This option only applies to Apache and LiteSpeed servers that use .htaccess files. Nginx doesn’t use .htaccess, so this setting has no effect on Nginx servers. For Nginx setup, see Setup WP Ghost on Nginx Server.
Should I enable this by default?
No. Keep the default placement unless you experience rules being removed by another plugin. The default placement (outside the WordPress block) is the standard approach and works correctly in most environments.
What happens when I deactivate WP Ghost?
WP Ghost automatically removes all its rewrite rules from .htaccess on deactivation, regardless of whether they were placed inside or outside the WordPress block. No manual cleanup is needed.
Does WP Ghost modify WordPress core files?
No. This option moves WP Ghost’s rules to a different location within .htaccess (a server configuration file, not a WordPress core file). No WordPress core files are modified.
Related Tutorials
Server configuration and compatibility:
- Hosting and Server Types – Ensure the correct server type is selected for proper rule generation.
- Plugin Loading Hook – Control when WP Ghost initializes relative to caching plugins.
- Set AllowOverride All on Apache – Required Apache setting for .htaccess rules to work.
- Rollback Settings – Recover access if rewrite rule changes break your site.
- Setup WP Ghost on Nginx Server – For Nginx servers that don’t use .htaccess.
