The RewriteEngine On line (as you have indicated) isn’t necessary, and pertains to a different module, mod_rewrite. You should remove it from the mod_headers block.
It’s possible that you don’t have the Headers Apache module installed or activated on your host. If it is possible to run the test with some breakage, you could try removing the If block and running the commands in the parent context. If it fails, that’s a good indication that it wasn’t working because Headers wasn’t installed.
If you are on a Debian system (Ubuntu, etc) you can enable the Headers Apache module like so via SSH:
sudo a2enmod headers
sudo service apache2 restart
Related Posts:
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- index.php not loading in main folder of wordpress
- Redirect from different port to subdomain – htaccess
- WordPress 404 on Subdomain
- Only expose routes with prefix /wp-json on WordPress using Apache
- What’s the opposite of required valid user in .htaccess authentication
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- Override htacces rule only for specific directory
- Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx – not only Apache – solution
- How do I test to ensure that my wp-config file is protected?
- mod_rewrite loop, redirecting http to https on certain section of wordpress blog
- .htaccess in subdir gets ignored by WordPress’ own .htaccess in /
- Directing subdomain to main domain and keeping the subdomain format with .htaccess
- WordPress – Promoting A Dev Build In A Subdirectory To Production / Root Directory
- Redirect old domain with query paramaters
- Does WP suppresses .htaccess if permalinks are disabled?
- fix 302 redirection error on https
- Access sub-domain when root public_html is protected with .htaccess password
- Accepting special characters in querystring
- WordPress permalinks confusion
- Configure .htaccess to have a WordPress single site installation with all subdomains pointing to the same pages?
- Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN
- How to move wordpress website from hosting account to localhost
- How to block wordpress admin by htaccess
- I can access subdirectory, but not files within it
- WordPress redirection
- How To Add CSP frame ancestors in WordPress Website? [closed]
- Subfolder install not working
- Browser Caching .htaccess
- .htaccess redirect http to https
- Redirect old php link to wordpress link in .htaccess
- Static raw HTML page
- htaccess rewrite for author query string when WP is in subfolder
- Why “Settings->Permalinks” creates .htaccess file on nginx server?
- .htaccess for wordpress inside another wordpress install
- .htaccess file redirecting to parent directory
- WordPress in sub directory wp-admin problem
- Rewrite rule not working
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- Temporary .htaccess blocking is disabling WP Crons from running?
- .htaccess redirects disappeared after re-saving permalinks
- How have I misconfigured basic auth for my wordpress site?
- WordPress trims off the forward slash when import
- WordPress multilingual website domain and folders
- Attach to wp-login.php and xmlrpc.php
- XMLRPC filtering through htaccess not working
- Corrupt .htaccess file
- Rule to redirect non logged in User to Custom Registration/login Page in .htaccess file
- Cache policy not updated according to PageSpeed
- How to redirect http://mydomain/blog/blahblah/ to http://mydomain/blahblah/ in wordpress htaccess?
- When is it necessary to have Header unset Vary in .htaccess
- Redirect http to https does not work on subdir where another instance of WordPress installed
- redirect the homepage using .htaccess outside of WordPress
- Https Redirect infinite loop in Mobile browsers
- 403 error on admin login page
- HTTP Error 406 always on site?
- Point all URLs to homepage but maintain URL
- htaccess working on local server but not on live server
- Page preview is shown, updating page gives 404 error
- External content won’t load in iframe in Safari
- How to write .htaccess so that https is on for subpages only but not the home page
- Custom rewrite rule, url returning 404
- mod_rewrite doesn’t work as I want even with JSON API Plugin disabled
- WordPress .htaccess file gives issues with subdirectory
- Need help rebuilding lost htaccess file
- W3 Total Cache CSS & JS files GZip issues [closed]
- WP Super Cache unable to locate cache file for only the homepage
- Cannot login to WordPress site after changing .htaccess for security purposes
- WordPress permalink, stop redirection
- How to rename index.php to home.php
- add_rewrite_rule to remove /category/ from permalink
- .htaccess Non-‘www’ to ‘www’ Subdomain Redirection Only Works for Homepage
- Non WordPress Folder in a WordPress Site
- Moving wordpress to different url/server creates redirect loop
- Htaccess rewrite based on query string, not working [closed]
- Redirect all subdomains to root domain
- Change root directory
- .htaccess redirect not properly working [ ?utm_source=]
- How to execute WordPress as though it is in the root folder while it is installed in a subdirectory?
- Htaccess maintenance page rules that actually work with WordPress?
- Multisite htaccess file causing segfault (Segmentation fault 11)
- How to allow only vpn access to dashboard on Bitnami WordPress by IP address restricting
- Blocking wp-login in HTACCESS has also blocked password protected pages
- htaccess redirect to path
- Non-wordpress subdomain on Multisite Installation
- Downloading zip or tar.gz inside WordPress installation?
- Rewrite rules and maintain URL
- Subfolder renaming
- Targeting .htaccess file with file_put_contents
- Redirect Loop in Regex Moving to HTTPS
- .htaccess file changes disappear
- WordPress login bug. Need an emergency solution
- .htaccess and virtual host configuration for WP in its own directory
- 403 forbidden due to .htaccess?
- Issue after changing permalink structure [duplicate]
- Can’t get pretty permalinks to work without index.php
- Where is the htaccess in wordpress.com hosting?
- Debug errors for “Destination directory for file streaming does not exist or is not writable”
- Url redirection using htacess for my website
- .htaccess seems to be required but I can not find it