=== Wondalizer Security Hide === Contributors: wondalizer Tags: security, htaccess, speed, anti-bloat, hide wp-admin Requires at least: 5.0 Tested up to: 6.7 Requires PHP: 7.4 Stable tag: 1.4.2 License: GPL-2.0-or-later Lightweight .htaccess hardening, path renaming, HTTP security headers and bloat removal. No per-request page rewriting; a tiny mu-plugin only fixes the admin cookie path for the renamed wp-admin slug. == Description == Wondalizer Security Hide takes a different approach from rewrite-based hiding plugins: the web server does the heavy lifting, once, in .htaccess files. Path renaming uses WordPress' own URL filters plus cheap string replacement on script/style URLs - the rendered page is never parsed. = Path renaming (v1.1) = * wp-content/plugins -> /modules/ (editable slug) * wp-includes -> /lib/ (editable slug) * wp-admin -> /control/ (editable slug) - covers admin-ajax.php and all admin screens * wp-login.php -> /access (editable slug) - covers login, logout and lost password URLs * Per-plugin directory aliases: each plugin folder can get its own public name, e.g. /modules/akismet/ -> /modules/shield/. Old aliases stop resolving when original-path lockdown is on. * Optional 403 lockdown of the ORIGINAL paths. The block inspects THE_REQUEST, so internal rewrites from the renamed slugs keep working. * The original wp-login.php can return 404 Not Found instead of 403, so it looks like it never existed. * Leave any slug empty to disable that rename. * Works on root and subdirectory installs. * Dashboard authentication on the renamed admin path is handled by an auto-generated mu-plugin (mu-plugins/wsh-cookie-path.php) which sets ADMIN_COOKIE_PATH before core defines it. It is written on activation/save and removed on deactivation. After enabling or changing the admin slug, log in once more so the browser receives the cookie for the new path. = Audio, WavePlayer and autoplay = Media compatibility is enabled by default. MP3 files are served as audio/mpeg, with byte-range responses left intact, gzip and Brotli recompression disabled, long-lived caching, CORS for static audio/video and cross-origin resource permission. Content-Encoding is never stripped from the response, preventing browsers from receiving compressed audio bytes without the encoding information they need. Static media requests are exempt from broad query-string exploit patterns so player, waveform and cache arguments do not make a valid MP3 look invalid. The PHP-execution block in uploads remains fully active. Same-origin autoplay is explicitly allowed through Permissions-Policy. This permits autoplay but cannot override browser rules that require a user gesture, muted playback or prior site engagement. If a custom CSP is enabled, its media-src directive must allow the site's own media and any blob:/data: sources required by the player. COEP/CORP compatibility for public media is included. = robots.txt = Core's virtual robots.txt is replaced so it disallows the RENAMED admin, includes, plugins and login paths (originals are never leaked) while keeping admin-ajax.php allowed. A physical robots.txt, if one exists, gets the same rules in a marked block; everything else in the file is preserved. = Server side (.htaccess, written on activation/save) = * Root: protects wp-config.php, readme/license/changelog files, backups, logs, dotfiles; disables directory browsing; hides X-Powered-By and the server signature; sends security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy); gzip/deflate compression; long browser caching for static assets; CORS headers for web fonts. * wp-content: blocks dotfiles, readme/license files and backups anywhere in the content directory (covers every plugin and theme). * wp-content/uploads: full PHP execution block plus double-extension protection. * wp-content/plugins: hides readme/license files and directory listing. * wp-includes: blocks direct access to PHP files (they are only meant to be included by WordPress); multisite ms-files/ms-blogs endpoints stay open. * wp-admin: blocks the installer files (install.php, setup-config.php) and dotfiles. Deactivate the plugin temporarily if a reinstall is ever needed. = PHP side (cheap filters only) = * Full wp_head cleanup: generator meta, RSD, wlwmanifest, shortlink, adjacent post links, REST API link, oEmbed discovery links, extra feeds. * Emoji scripts/styles and emoji DNS prefetch removed everywhere. * Pingbacks: X-Pingback header, xmlrpc pingback methods and self-pings removed. * Optional full XML-RPC lockdown (checkbox or WSH_DISABLE_XMLRPC constant). * Gutenberg / block editor fully disabled; block editor CSS removed from the front-end; classic widgets editor kept. * ?ver= query strings stripped from all script/style URLs (hides WP and plugin versions from page source). * HTML comments (plugin fingerprinting) stripped from front-end output with a single lightweight pass; IE conditional comments preserved. Disable with the `wsh_strip_html_comments` filter or the WSH_STRIP_COMMENTS constant. * Dashicons and the oEmbed front-end script removed for logged-out visitors. * jQuery Migrate deregistered on the front-end (filterable). * Heartbeat calmed to 60s and disabled on the front-end. * Author enumeration via ?author=1 blocked; REST API user listing (/wp/v2/users) hidden from logged-out visitors; application passwords disabled; theme/plugin file editor disabled (DISALLOW_FILE_EDIT). == Optional constants == Define in wp-config.php before activation for the matching .htaccess rule: * `WSH_DISABLE_XMLRPC` (true) - also blocks xmlrpc.php at the server level. * `WSH_STRIP_COMMENTS` (false) - keep HTML comments (default is strip). == Filters == * `wsh_strip_html_comments` - return false to keep HTML comments. * `wsh_remove_jquery_migrate` - return false to keep jQuery Migrate. * `wsh_hide_rest_users` - return false to keep public REST user routes. == Frequently Asked Questions == = Where are the settings? = Tools > Wondalizer Security. Edit slugs, toggle original-path lockdown, robots.txt management and XML-RPC; saving applies the .htaccess rules at once. A status table shows which files carry the rules; one-click re-apply/remove is available. Re-apply after switching hosts or if another plugin rewrote .htaccess. = Will renamed paths break my site? = All core URL APIs are filtered (plugins_url, includes_url, admin_url, network_admin_url, site_url, network_site_url, login/logout/lostpassword, redirects and script/style loader URLs). Plugins that hard-code /wp-admin/ or /wp-content/plugins/ URLs instead of using the WordPress APIs may need fixing; in that case empty the matching slug or disable original-path lockdown. = Multisite? = Not supported yet; the plugin does not write rules on a network install. == Changelog == = 1.4.2 = * New eCommerce compatibility mode (on by default; settings -> Path renaming) for WooCommerce and Easy Digital Downloads: - Downloadable product files under wp-content/uploads (and the renamed media slug) stay directly reachable, including archives such as zip, so digital downloads and media-modal previews are no longer denied by the backup-archive protection rules. - The conditional archive deny moved fully into the root .htaccess; the wp-content/.htaccess intentionally carries no mod_rewrite block, because Apache stops applying the root rewrite rules to /wp-content/* URLs once a deeper directory has its own rewrite rules (that would silently break path renaming and the media slug). - Logged-in administrators are never locked out of the original /wp-admin/, /wp-content/plugins/ and wp-includes paths hardcoded in shop-plugin admin JS; guests and bots still are. - The query-string firewall spares admin-ajax.php, admin-post.php and async-upload.php, whose authenticated WooCommerce/EDD requests carry legitimate URL parameters (e.g. &return_url=https://...). = 1.4.1 = * Fix Brotli-compressed MP3/video bytes being delivered without Content-Encoding, which caused WavePlayer to remain in audio analysis indefinitely in browsers offering Brotli. Static media now sets Apache's no-brotli flag as well as no-gzip. * Stop removing Content-Encoding from media responses. If another upstream layer intentionally encodes a response, its encoding metadata now remains accurate. * Apply the same double-compression protection to load-scripts/load-styles. = 1.4.0 = * Fix WavePlayer/MP3 invalid-file failures: explicit audio/mpeg MIME type, byte-range streaming headers, no audio compression or content encoding, static-media cache/CORS/CORP handling and broad query-firewall exemptions. * New media compatibility toggle covers MP3, M4A, AAC, Ogg, WAV, FLAC, MP4 and WebM without weakening the uploads PHP-execution block. * New same-origin autoplay permission (enabled by default). Browser gesture and muted-autoplay policies still apply and cannot be bypassed by a server. * Assessed All-In-One Security (AIOS) and NinjaFirewall. Added default-on filtering for raw/encoded PHP stream wrappers in query strings. * Added optional AIOS-inspired empty user-agent/referrer POST filtering with core callback/API exclusions, and optional IPv4 Host-header blocking. Both compatibility-sensitive rules are off by default. * No brute-force firewall, plugin/theme firewall, output rewriting or per-page WAF processing was added. = 1.3.1 = * Fix: /access now authenticates correctly. Core builds the login form action with site_url('wp-login.php', 'login_post'), not login_url(); site_url, network_site_url and wp_redirect are now covered so login posts, logout, lost-password and authentication redirects all use the renamed path. * Internal base paths use the raw siteurl option, preventing recursion through the newly covered site_url filter. * Login privacy shielding, inspired by WP Ghost: generic login errors avoid revealing whether a username exists, and the login language selector is hidden. Enabled by default and separately switchable. * Protect wp-config-sample.php as well as wp-config.php. * Shielding procedures assessed against WPS Hide Login and Hide My WP Ghost / WP Ghost; adopted their lightweight URL/filter and login-privacy approaches without adding output rewriting, brute-force or plugin/theme firewalls. = 1.3.0 = * Media renaming: wp-content/uploads -> /media/ (upload_dir filter + rewrite; original URLs keep working for existing content). * Per-plugin rename list: Active / Inactive / All filter tabs with counts. * HTTP Headers plugin coverage: HSTS max-age/includeSubDomains/preload, COOP/CORP/COEP, X-XSS-Protection, X-Download-Options, X-DNS-Prefetch-Control, CSP report-only mode, Access-Control-Allow-Origin (+credentials), custom headers field. Imperative headers default on; deprecated Expect-CT/HPKP intentionally excluded. * Header takeover option: strips Header/RequestHeader lines from other plugins' marked .htaccess blocks (HTTP Headers, WP Hide, Really Simple Security, BPS custom blocks) so only this plugin's headers apply. * BPS/6G-inspired request firewall: TRACE/TRACK/DEBUG methods, suspicious URIs, traversal, script/iframe injection, GLOBALS/_REQUEST, base64, SQL union, RFI query strings, author scans. Optional scanner user-agent blocking. Plugin/theme firewall and brute-force features intentionally excluded (per requirements). * Extra file protection for php.ini/.user.ini/bb-config.php. * Plugin Check / PHPCS fixes: all heredocs removed, input sanitization, nonce-verification annotations, wp_delete_file(), false-positive offloading annotation, readme tag/description limits. = 1.2.1 = * Fix: broken admin CSS/JS (text-only wp-admin pages) on some servers. load-styles.php and load-scripts.php gzip their own output; mod_deflate was compressing them a second time. They are now excluded via no-gzip. * New compatibility toggle (on by default): original admin asset endpoints (load-styles/load-scripts/admin-ajax/admin-post/async-upload) and static css/js/image/font files stay reachable even with original-path lockdown, fixing setups with hard-coded asset URLs. * /control without a trailing slash now also reaches the dashboard. = 1.2.0 = * Per-plugin directory renaming with its own settings table. * wp-login.php 404 mode (looks nonexistent) instead of 403. * On/off toggles for every PHP feature group: head cleanup, emojis, Gutenberg, comment stripping, ver removal, pingbacks, author scan block, REST user hiding, application passwords, file editor, Heartbeat, jQuery Migrate. * On/off toggles for .htaccess rule groups: security headers, compression, caching, sensitive-file protection, uploads PHP block, wp-includes PHP block, directory listing. * Extra HTTP security headers (inspired by http-headers plugins): HSTS, Cross-Origin-Opener-Policy, Cross-Origin-Resource-Policy, X-Permitted-Cross-Domain-Policies and an optional free-form Content-Security-Policy field. * Optional full REST API lockdown for logged-out visitors. * Fix: PHP warning "Undefined array key interval" in heartbeat_settings. = 1.1.1 = * Fix: dashboard access after renaming wp-admin. WordPress scopes the admin auth cookie to /wp-admin, so the browser never sent it to the renamed path and auth_redirect() forced a reauth loop. A minimal mu-loader now defines ADMIN_COOKIE_PATH for the renamed slug (mu-plugins load before core cookie constants; regular plugins load too late). * mu-loader is written on activation/save/upgrade and removed on deactivation. = 1.1.0 = * Path renaming for plugins, wp-includes, wp-admin and wp-login.php via URL filters + .htaccess rewrites (no page rewriting). * Optional 403 lockdown of original paths (THE_REQUEST-based, safe for internal rewrites). * robots.txt handling for renamed paths, virtual and physical file. * Settings screen under Tools with slugs and toggles. * REST API user enumeration blocked for logged-out visitors. * XML-RPC lockdown available as a setting (constant still supported). * Automatic .htaccess sync after plugin updates. = 1.0.0 = * Initial release.