2

One small hiccup is that you'll need to update RewriteRule ./ in that second to last line. Here is an updated (and tested) snippet for you: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_URI} !^/foo/.*$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-...


2

You should use RewriteCond instead of RewriteRule. Use this: RewriteCond %{REQUEST_URI} !/foo/ So, for example, the full code could be like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_URI} !/foo/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}...


2

So I'm not sure why that RewriteRule returned a 404 error for you, because I've tested it and it did work as expected — if permalinks are actually enabled, you would be redirected to the actual post permalink. And here's the content of my .htaccess file: RewriteEngine On RewriteRule ^go/(\d+)$ /?p=$1 [R=302,L] # BEGIN WordPress <IfModule mod_rewrite.c&...


1

My question is, should I be doing it this way? Yes, but only if the other possible/better fixes do not work for you. You can also read this article about troubleshooting common WordPress errors such as the "headers already sent" error. And when developing a plugin/theme, I suggest you to turn on WordPress debugging because normally, you would be able to ...


1

The following rule works for me RewriteRule ^(foo)($|/) - [L] meaning, any path beginning with foo like /foo/, /foo/bar/ or whatever, leads to the Apache 404 instead of the themes 404; under the assumption that there is no actual directory with that path. The rule has to be before the last standard line of the WordPress block: RewriteRule . /index.php [L]...


Only top voted, non community-wiki answers of a minimum length are eligible